Handlebar helpers for cortex template.
$ npm install cortex-handlebars-compiler --savevar compiler = require('cortex-handlebars-compiler');Returns the compiler.Compiler instance.
A single compiler instance only cares about one template file.
- options
Object- pkg
Objectobject of cortex.json - shrinkWrap
Objectobject of cortex-shrinkwrap.json - cwd
paththe root directories of current project. - path
pathpath of the current template file - href_root
urlthe url base of the hyper reference,'efte://efte'for example.
- pkg
- template
Stringtemplate 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: tree
path: "../../../"
});
</script>
<script>
facade({
mod:"cortex-hybrid-sample@0.1.0"
});
</script>
</body>
</html>- helper
Stringthe name of the helper - handler
function(title, helper_options)see handlebars for details
Registers a new helper handler.
Returns this.
The first 'facade' will also output the engines and configurations.
Creates a special link to navigate through business units
Relative links: ./page.html
External link to other units: <unit-name>/path/to.html
<!--
If the current unit is 'foo',
and the current template is 'template/a.html'
-->
<a href="{{{href './b.html'}}}" >link</a>
<a href="{{{href 'bar/folder/index.html'}}}">external link</a>You will get:
<a href="efte://efte/foo/template/a.html">link</a>
<a href="efte://efte/bar/folder/index.html">external link</a>MIT