add getTemplateForString

This commit is contained in:
Philipp Kunz 2017-05-26 15:16:33 +02:00
parent 2246f101ba
commit f917820545
3 changed files with 18 additions and 1 deletions

View File

@ -3,3 +3,7 @@
* get a template for a file on disk * get a template for a file on disk
*/ */
export declare let getTemplateForFile: (filePathArg: string) => Promise<HandlebarsTemplateDelegate>; export declare let getTemplateForFile: (filePathArg: string) => Promise<HandlebarsTemplateDelegate>;
/**
* get a template for string
*/
export declare let getTemplateForString: (fileStringArg: string) => Promise<HandlebarsTemplateDelegate>;

View File

@ -16,4 +16,10 @@ exports.getTemplateForFile = (filePathArg) => __awaiter(this, void 0, void 0, fu
let filePathAbsolute = plugins.path.resolve(filePathArg); let filePathAbsolute = plugins.path.resolve(filePathArg);
return plugins.handlebars.compile(plugins.smartfile.fs.toStringSync(filePathAbsolute)); return plugins.handlebars.compile(plugins.smartfile.fs.toStringSync(filePathAbsolute));
}); });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMudGVtcGxhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGhicy50ZW1wbGF0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsOENBQTZDO0FBRTdDOztHQUVHO0FBQ1EsUUFBQSxrQkFBa0IsR0FBRyxDQUFPLFdBQW1CO0lBQ3hELElBQUksZ0JBQWdCLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsV0FBVyxDQUFDLENBQUE7SUFDeEQsTUFBTSxDQUFDLE9BQU8sQ0FBQyxVQUFVLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDLENBQUE7QUFDeEYsQ0FBQyxDQUFBLENBQUEifQ== /**
* get a template for string
*/
exports.getTemplateForString = (fileStringArg) => __awaiter(this, void 0, void 0, function* () {
return plugins.handlebars.compile(fileStringArg);
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMudGVtcGxhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGhicy50ZW1wbGF0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsOENBQTZDO0FBRTdDOztHQUVHO0FBQ1EsUUFBQSxrQkFBa0IsR0FBRyxDQUFPLFdBQW1CO0lBQ3hELElBQUksZ0JBQWdCLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsV0FBVyxDQUFDLENBQUE7SUFDeEQsTUFBTSxDQUFDLE9BQU8sQ0FBQyxVQUFVLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDLENBQUE7QUFDeEYsQ0FBQyxDQUFBLENBQUE7QUFFRDs7R0FFRztBQUNRLFFBQUEsb0JBQW9CLEdBQUcsQ0FBTyxhQUFxQjtJQUM1RCxNQUFNLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQyxPQUFPLENBQUMsYUFBYSxDQUFDLENBQUE7QUFDbEQsQ0FBQyxDQUFBLENBQUEifQ==

View File

@ -7,3 +7,10 @@ export let getTemplateForFile = async (filePathArg: string) => {
let filePathAbsolute = plugins.path.resolve(filePathArg) let filePathAbsolute = plugins.path.resolve(filePathArg)
return plugins.handlebars.compile(plugins.smartfile.fs.toStringSync(filePathAbsolute)) return plugins.handlebars.compile(plugins.smartfile.fs.toStringSync(filePathAbsolute))
} }
/**
* get a template for string
*/
export let getTemplateForString = async (fileStringArg: string) => {
return plugins.handlebars.compile(fileStringArg)
}