This commit is contained in:
2017-05-10 16:55:25 +02:00
parent 1fbf624c12
commit 75f3aff2c2
11 changed files with 180 additions and 30 deletions

View File

@ -1,8 +1,24 @@
import * as plugins from './smarthbs.plugins'
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'
})
plugins.handlebars.registerHelper('__compile', (evaluationString, evaluationContext) => {
let template = plugins.handlebars.compile(evaluationString)
return template(evaluationContext)
})

View File

@ -1,4 +1,5 @@
import 'typings-global'
import * as beautylog from 'beautylog'
import * as handlebars from 'handlebars'
import * as lodash from 'lodash'
import * as path from 'path'
@ -6,6 +7,7 @@ import * as smartfile from 'smartfile'
import * as smartq from 'smartq'
export {
beautylog,
handlebars,
lodash,
path,