dot-ify
Version:
make dot templates 'requireable' when using browserify
59 lines (41 loc) • 997 B
Markdown
[](https://npmjs.org/package/dot-ify)
[](https://travis-ci.org/royriojas/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
```bash
npm i --save dot-ify
```
In code
```javascript
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
```javascript
{
"browserify" : {
"transforms": [
"dot-ify"
]
}
}
```
Then in your code
```javascript
var tpl = require('./some-tpl.dot')
var content = tpl.render({
some:'variable here'
});
```
[](./LICENSE)
[](./changelog.md)