browserify-underscore-template

0.0.3 • Public • Published

browserify-underscore-template

A basic browserify transform to compile underscore templates

Example

templates/view.html:

<h1><%- title %></h1>
<p><%- text %></p>

src/view.js

var tpl = require('../templates/test.html');
 
console.log(tpl({
  title: 'Test Title'
  text: 'This is test content'
}));

cli:

$ browserify -t [ browserify-underscore-templates --extension .html ] ./src/view.js ./templates/test.html > ./views.js
$ node views.js
<h1>Test Title</h1>
<p>This is test content</p>

Alterantives

There is an alternative compiler at https://github.com/robrichard/browserify-compile-templates.

Package Sidebar

Install

npm i browserify-underscore-template

Weekly Downloads

2

Version

0.0.3

License

MIT

Last publish

Collaborators

  • alex-dow