39 lines
2.6 KiB
JavaScript
39 lines
2.6 KiB
JavaScript
|
"use strict";
|
||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||
|
if (mod && mod.__esModule) return mod;
|
||
|
var result = {};
|
||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||
|
result["default"] = mod;
|
||
|
return result;
|
||
|
};
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
const plugins = __importStar(require("./smarthbs.plugins"));
|
||
|
/**
|
||
|
* Helper:
|
||
|
* Allows you to analyze a context
|
||
|
*/
|
||
|
plugins.handlebars.registerHelper('__analyze', analyzeContext => {
|
||
|
if (typeof analyzeContext === 'string') {
|
||
|
if (plugins.handlebars.partials[analyzeContext]) {
|
||
|
console.log(`The analyzed partial ${analyzeContext} looks like this`);
|
||
|
console.log(plugins.handlebars.partials[analyzeContext]);
|
||
|
}
|
||
|
else {
|
||
|
console.error(`The Partial ${analyzeContext} cannot be found`);
|
||
|
}
|
||
|
return 'analyzed';
|
||
|
}
|
||
|
});
|
||
|
/**
|
||
|
* Helper:
|
||
|
* logs all registered partials to console
|
||
|
*/
|
||
|
plugins.handlebars.registerHelper('__allPartialsLog', analyzeContext => {
|
||
|
console.log(plugins.handlebars.partials);
|
||
|
return 'analyzed';
|
||
|
});
|
||
|
plugins.handlebars.registerHelper('__compile', (evaluationString, evaluationContext) => {
|
||
|
let template = plugins.handlebars.compile(evaluationString);
|
||
|
return template(evaluationContext);
|
||
|
});
|
||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMuaGVscGVycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0aGJzLmhlbHBlcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O0FBQUEsNERBQThDO0FBRTlDOzs7R0FHRztBQUNILE9BQU8sQ0FBQy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