Skip to content
This repository has been archived by the owner on Jul 21, 2022. It is now read-only.

Latest commit

 

History

History
109 lines (64 loc) · 1.58 KB

README.md

File metadata and controls

109 lines (64 loc) · 1.58 KB

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.

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