underscore.template
v0.1.7
Published
Extracted template from Underscore, use '_.template' without full underscore source.
Downloads
13,692
Maintainers
Readme
underscore.template
Extracted template from Underscore, use
_.template
without full underscore source.
Installation
NPM
npm install underscore.template
Bower
bower install underscore.template
Usage
Node.js
var UnderscoreTemplate = require('underscore.template');
var template = UnderscoreTemplate("<b><%- value %></b>");
template({value: 'hello world'});
// <b>hello world</b>
template({value: '<script>'});
// <b><script></b>
Browser
Simply download the latest minified version from the dist/
folder. API is available in a global object called UnderscoreTemplate
.
<script src="./dist/underscore.template.js"></script>
var template = UnderscoreTemplate("<b><%- value %></b>");
template({value: 'hello world'});
// <b>hello world</b>
Testing
npm test
License
MIT, see the LICENSE file for detail.