2022-07-24 15:30:19 +02:00
|
|
|
import * as plugins from './smarthbs.plugins.js';
|
2017-03-19 17:14:28 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* get a template for a file on disk
|
|
|
|
|
*/
|
|
|
|
|
export let getTemplateForFile = async (filePathArg: string) => {
|
2026-04-30 10:20:07 +00:00
|
|
|
const filePathAbsolute = plugins.path.resolve(filePathArg);
|
|
|
|
|
const fileString = await plugins.smartFs.file(filePathAbsolute).encoding('utf8').read() as string;
|
|
|
|
|
return plugins.handlebars.compile(fileString);
|
2018-08-27 23:04:15 +02:00
|
|
|
};
|
2017-05-26 15:16:33 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* get a template for string
|
|
|
|
|
*/
|
|
|
|
|
export let getTemplateForString = async (fileStringArg: string) => {
|
2018-08-27 23:04:15 +02:00
|
|
|
return plugins.handlebars.compile(fileStringArg);
|
|
|
|
|
};
|