Files
smarthbs/ts/smarthbs.template.ts
T

18 lines
538 B
TypeScript

import * as plugins from './smarthbs.plugins.js';
/**
* get a template for a file on disk
*/
export let getTemplateForFile = async (filePathArg: string) => {
const filePathAbsolute = plugins.path.resolve(filePathArg);
const fileString = await plugins.smartFs.file(filePathAbsolute).encoding('utf8').read() as string;
return plugins.handlebars.compile(fileString);
};
/**
* get a template for string
*/
export let getTemplateForString = async (fileStringArg: string) => {
return plugins.handlebars.compile(fileStringArg);
};