cortex-handlebars-compiler

Handlebar helpers for cortex template.
Install
$ npm install cortex-handlebars-compiler --save
Usage
var compiler = require('cortex-handlebars-compiler');
compiler(options)
Returns the compiler.Compiler
instance.
Class: compiler.Compiler(options)
- options
Object
- pkg
Object
object of cortex.json - root
path
the root directories of packages - shrinkWrap
Object
object of cortex-shrinkwrap.json - ext
String='.js'
the extension of module files, default to '.js'
.compile(template)
- template
String
template string
Parses the template string and returns function(data)
the parsed function.
template:
<body>
{{{facade 'a@1.0.0'}}}
</body>
instance.compile(template)();
Then you will get: (which is beautified)
<html>
<head></head>
<body>
<script src="../../../neuron/5.1.0/neuron.min.js"></script>
<script>
neuron.config({
ranges: {
"jquery": {
"~1.9.2": "1.9.2"
},
"neuron": {
"latest": "5.1.0"
}
},
depTree: {
"cortex-hybrid-sample": {
"0.1.0": [{
"jquery": "~1.9.2"
}, {}]
}
},
path: "../../../"
});
</script>
<script>
facade({
mod:"cortex-hybrid-sample@0.1.0"
});
</script>
</body>
</html>
.register(helper, handler)
- helper
String
the name of the helper - handler
function(title, helper_options)
see handlebars for details
Registers a new helper handler.
Returns this
.
Built-in helpers
{{{facade '<package-name>'}}}
The first 'facade' will also output the engines and configurations.
License
MIT