#tinytim for node.js [![Build Status](https://secure.travis-ci.org/baryon/node-tinytim.png)](http://travis-ci.org/baryon/node-tinytim) Node.js port of [tinytim](https://github.com/premasagar/tim/) (A tiny, secure JavaScript micro-templating script) ##Install ----- ```javascript npm install tinytim ``` Usage ----- Add to your code: ```javascript var tim = require('tinytim').tim; var result = tim("Hello {{place}}", {place: "world"}); console.log(result); // Hello world ``` See [test/tim-replace.js](https://github.com/baryon/node-tinytim/blob/master/test/tim-replace.js) as example and support render and renderFile methods. See [test/render-replace.js](https://github.com/baryon/node-tinytim/blob/master/test/render-replace.js) and [test/render-file-replace.js](https://github.com/baryon/node-tinytim/blob/master/test/render-file-replace.js) for details. ```javascript var tinytim = require('tinytim'); var result = tinytim.render("Hello {{place}}", {place: "world"}); console.log(result); // Hello world ``` ```javascript var tinytim = require('tinytim'); var result1 = tinytim.renderFile("./hello.tim", {place: "world"}); console.log(result1); // Hello world var result2 = tinytim.renderFile("./hello.tim", {place: "world"}, true); //use cache to render console.log(result2); // Hello world ``` # Tim A tiny, secure JavaScript micro-templating script. Tim lets you write simple templates that uses JavaScript's familiar dot notation. You pass in a JavaScript object that contains all the relevant strings, and they are then substituted into the template. For example: tim("Hello {{place}}", {place: "world"}); // "Hello world" * by [Premasagar Rose](http://premasagar.com) ([Dharmafly](http://dharmafly.com)) * source: [github.com/premasagar/tim](http://github.com/premasagar/tim) ([MIT license](http://opensource.org/licenses/mit-license.php)) * ~200 bytes minified & gzipped ## Why is micro-templating useful? Don't you just hate having to write HTML with a mess of string concatenation that clutters up your JavaScript?: var myHTML = "