tmplt
v0.1.3
Published
Minimal templating for JavaScript.
Downloads
4
Maintainers
Readme
tmplt.js
Minimal templating for JavaScript.
Usage
var tmpl = '{ foo }, { bar.baz }!';
var data = {
foo: 'Hello',
bar: {
baz: 'World'
}
};
tmplt(tmpl)(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:
<body>
<!-- ... -->
<script src="path/to/tmplt.min.js"></script>
<script>
// tmplt available here
</script>
</body>
Changelog
- 0.1.0
- Initial release