tmplt

0.1.3 • Public • Published

tmplt.js npm Version Build Status Coverage Status

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

License

MIT license

Package Sidebar

Install

npm i tmplt

Weekly Downloads

2

Version

0.1.3

License

MIT

Last publish

Collaborators

  • yuanqing