smarthbs/ts/smarthbs.helpers.ts

25 lines
828 B
TypeScript
Raw Normal View History

2017-03-19 16:14:28 +00:00
import * as plugins from './smarthbs.plugins'
2017-05-10 14:55:25 +00:00
plugins.handlebars.registerHelper('__analyze', (analyzeContext) => {
if (typeof analyzeContext === 'string') {
if (plugins.handlebars.partials[analyzeContext]) {
plugins.beautylog.log(`The analyzed partial ${analyzeContext} looks like this`)
console.log(plugins.handlebars.partials[analyzeContext])
} else {
plugins.beautylog.error(`The Partial ${analyzeContext} cannot be found`)
}
return 'analyzed'
}
})
plugins.handlebars.registerHelper('__allPartialsLog', (analyzeContext) => {
console.log(plugins.handlebars.partials)
return 'analyzed'
})
2017-03-25 19:23:47 +00:00
plugins.handlebars.registerHelper('__compile', (evaluationString, evaluationContext) => {
let template = plugins.handlebars.compile(evaluationString)
return template(evaluationContext)
})
2017-03-19 16:14:28 +00:00