tmplt.js
Minimal templating for JavaScript.
Usage
var tmpl = '{ foo }, { bar.baz }!';var data = foo: 'Hello' bar: baz: 'World' ; data; //=> 'Hello, World!'
API
tmplt(tmpl)(data)
Returns a String, the result of interpolating data
into tmpl
.
tmpl
— The template String.data
— An Object literal of values.
Installation
Install via npm:
$ npm i --save tmplt
Install via bower:
$ bower i --save yuanqing/tmplt
To use tmplt in the browser, include the minified script in your HTML:
<!-- ... -->
Changelog
- 0.1.0
- Initial release