add __compile helper

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

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)
})