Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

155 lines (111 sloc) 2.057 kb


Templite aims to be a very small and lightweight, javascript template rendering engine. It can be used standalone, in node, bower or with ender.


# With npm
npm install templite

# With bower
bower install templite

# With ender
ender add templite


templite.render( string, object );

Root properties

This format parses properties directly from the root data object. Note the leading dot notation.

templite.render( html, {
    name: "kitajchuk",
    stats: {
        kickflips: 37

Hash conditions

This format uses the mustache style hash syntax for iteration and/or defined or not null.


templite.render( html, {
    dude: {
        age: 27,
        name: "kitajchuk",
        stats: {
            power: null,
            transport: "skateboard"


If a tag represents a function, it will be called.

templite.render( html, {
    pi: function () {
        return Math.PI;

Array iterations

This format allows using a single {{.}} tag to print the current array index.

<!-- Print current array index if string -->

<!-- Print prop of current array index if object -->
templite.render( html, {
    dudes: [

    folks: [
        {name: "Scott"},
        {name: "Todd"},
        {name: "Neil"}



# Render the template
node test/test.js

# Test with Grunt
grunt nodeunit


# Start the node server
node server/server.js

You should be able to go here localhost:5050

Jump to Line
Something went wrong with that request. Please try again.