add __compile helper

This commit is contained in:
Philipp Kunz 2017-03-25 20:23:47 +01:00
parent fef292d81f
commit 69ff80cc2b
6 changed files with 18 additions and 9 deletions

4
dist/index.d.ts vendored
View File

@ -1,5 +1,7 @@
/// <reference types="handlebars" />
export declare type TTemplateStringType = 'filePath' | 'code';
export declare let handlebars: typeof Handlebars;
export * from './smarthbs.compile';
export * from './smarthbs.helpers';
import './smarthbs.helpers';
export * from './smarthbs.partials';
export * from './smarthbs.template';

6
dist/index.js vendored
View File

@ -3,8 +3,10 @@ function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./smarthbs.plugins");
exports.handlebars = plugins.handlebars;
__export(require("./smarthbs.compile"));
__export(require("./smarthbs.helpers"));
require("./smarthbs.helpers");
__export(require("./smarthbs.partials"));
__export(require("./smarthbs.template"));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUdBLHdDQUFrQztBQUNsQyx3Q0FBa0M7QUFDbEMseUNBQW1DO0FBQ25DLHlDQUFtQyJ9
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLDhDQUE2QztBQUdsQyxRQUFBLFVBQVUsR0FBRyxPQUFPLENBQUMsVUFBVSxDQUFBO0FBQzFDLHdDQUFrQztBQUNsQyw4QkFBMkI7QUFDM0IseUNBQW1DO0FBQ25DLHlDQUFtQyJ9

View File

@ -1,2 +0,0 @@
/// <reference types="handlebars" />
export declare let registerHelper: typeof Handlebars.registerHelper;

View File

@ -1,5 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./smarthbs.plugins");
exports.registerHelper = plugins.handlebars.registerHelper;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMuaGVscGVycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0aGJzLmhlbHBlcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw4Q0FBNkM7QUFFbEMsUUFBQSxjQUFjLEdBQUcsT0FBTyxDQUFDLFVBQVUsQ0FBQyxjQUFjLENBQUEifQ==
plugins.handlebars.registerHelper('__compile', (evaluationString, evaluationContext) => {
let template = plugins.handlebars.compile(evaluationString);
return template(evaluationContext);
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMuaGVscGVycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0aGJzLmhlbHBlcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw4Q0FBNkM7QUFFN0MsT0FBTyxDQUFDLFVBQVUsQ0FBQyxjQUFjLENBQUMsV0FBVyxFQUFFLENBQUMsZ0JBQWdCLEVBQUUsaUJBQWlCO0lBQ2pGLElBQUksUUFBUSxHQUFHLE9BQU8sQ0FBQyxVQUFVLENBQUMsT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBQUE7SUFDM0QsTUFBTSxDQUFDLFFBQVEsQ0FBQyxpQkFBaUIsQ0FBQyxDQUFBO0FBQ3BDLENBQUMsQ0FBQyxDQUFBIn0=

View File

@ -1,7 +1,8 @@
import * as plugins from './smarthbs.plugins'
export type TTemplateStringType = 'filePath' | 'code'
export let handlebars = plugins.handlebars
export * from './smarthbs.compile'
export * from './smarthbs.helpers'
import './smarthbs.helpers'
export * from './smarthbs.partials'
export * from './smarthbs.template'

View File

@ -1,4 +1,7 @@
import * as plugins from './smarthbs.plugins'
export let registerHelper = plugins.handlebars.registerHelper
plugins.handlebars.registerHelper('__compile', (evaluationString, evaluationContext) => {
let template = plugins.handlebars.compile(evaluationString)
return template(evaluationContext)
})