lt

Little Template engine for {{mustache}}

npm install lt
2 downloads in the last week
39 downloads in the last month

LT

Build Status

Little Template engine with {{Mustache}} specification implemented in javascript.

Installation

$ npm install lt

or download

Syntax

Detail see here

Variables

this is {{name}}

self print {{.}}

Unescape HTML tags

print some html {{&content}}

Sections

Use Non-False values or iterate Non-Empty lists.

{{#items}}
    {{name}}
{{/items}}

Inverted Sections

{{^money}}
    show me the money
{{/money}}

Comments

{{! here is comments }}

Partials

TODO

Lambdas

TODO

Extra Features

Nested path

LT supports nested path like javascript. Note that you cannot read property of null or undefined value.

this is {{path.to.value}}

Parent path

../ references that use variable of parent context.

{{#child}}
    {{../name}}
{{/child}}

Extremely fast

Morden Mustache-style template engine Benchmark Benchmark

API

lt(source), lt.compile(source)

Compile source(String) to template(Function)

template(data), template.render(data)

Render data(Object/JSON), return String

License

MIT

npm loves you