Dust.js

From Wiki @ Karl Jones dot com
Jump to: navigation, search

Dust.js is a JavaScript templating engine designed to provide a clean separation between presentation and logic without sacrificing ease of use. It is particularly well-suited for asynchronous and streaming applications.

Description

A pure JavaScript library, Dust is runs in both browser-side and server-side environments.

Dust templates are compiled and then loaded where they are needed along with the runtime library. The library doesn't make any assumptions about how templates are loaded; you are free to integrate templating into your environment as you see fit.

Syntax

Dust templates use two types of tags: keys and sections.

Keys reference fields within the current view context. You can think of them as placeholders that allow the context to insert data into the template. Sections accept template blocks that may be enumerated, filtered or transformed in various ways.

Keys

To reference a key from the view context within the template, enclose the key in curly braces.

See also

External links