dot-ify
v0.1.0
Published
make dot templates 'requireable' when using browserify
Downloads
11
Maintainers
Readme
dot-ify
make dot templates 'requireable' when using browserify
- name the exported function as the file being required
- exports an object that contains a render method which is the compiled template
Install
npm i --save dot-ify
Usage
In code
var b = browserify();
var dotify = require('dot-ify');
// regular way to include it
b.transform(dotify);
// make it global
b.transform({ global: true}, dotify);
or in the package.json
file
{
"browserify" : {
"transforms": [
"dot-ify"
]
}
}
Then in your code
var tpl = require('./some-tpl.dot')
var content = tpl.render({
some:'variable here'
});