Dust
Dust Highlights!
- async/streaming operation
- browser/node compatibility
- extended Mustache/ctemplate syntax
- clean, low-level API
- high performance
- composable templates
This is the LinkedIn fork of Dust
Details in the blog post :
Leaving jsps in the Dust
We chose Dust after evaluating a bunch of others. Read more here :
Dust for client templates at LinkedIn
We will gradually be extending this library with core feature enhancements, helper functions and bug fixes.
Dust Quick Tutorial
Learn how to use LinkedIn fork of Dust
Dust core features - Code examples
Learn by playing with the dust templates
Dust helpers - Code examples
Learn how to use the helpers
Dust With Express/Node
Get started with using dust with express in node.js
LinkedIn additions include:
Release 1.2.3
Perf Improvements for IE7
- PR-253: performance enhancement in IE7
Release 1.2.2
Bug fixes
- GH-245: solve incorrect error line reported in pegjs
- GH-241: using dust.isArray in place of Array.isArray
Release 1.2.1
Bug fixes
- GH-220 - Reverted in V1.2.1 because of functional issues it introduced
Release 1.2.0
Core enhancements
- GH- 166 - Added trimming of white spaces in dust templates configuration in the dust.compile ( default option is still true)
Bug fixes/ perf improvements
- GH-148 - Fix the array reference access with $idx
- GH-187 - Whitespace grammar rule for partial is now consistent with ther tags
- GH-203 - Doc updated
- GH-212 - jam support for dust
- GH-216 - Add missing semicolon to help with minify
- GH-220 - Reverted in V1.2.1
- GH-222 - Fix regression add back $idx within a nested object in an array
Test enhancements
- Tests's description updated to be more descriptive.
- Bug fixes and UI improved.
- Tests grouped by category
Release 1.1.0
Core enhancements
- Extend the #section block to support $idx and $len for lists of primitives
- Add support for assigning multiple event-listeners on stream
Bug fixes/ perf improvements
- Fix the #section block on how it behaves with empty arrays. Maintain consistency between ?, # and ^ for truthy/falsy evaluations
- Fix "this" value in anonymous functions passed into the context object
- Handle undefined filters and helpers gracefully
Extensions and helpers
- Helpers are now in its own node package See here
-
@math for simple math operations such as add/subtract/mod/ceil etc. It also supports branching based on the output of math operation
-
@size helper for determining the size of lists/objects/primitives
- @contextDump helper for debugging the current context in the dust stack
NOTE: We have removed dust helpers code from the dustjs-linkedin repo from V1.1.1, use npm install dustjs-helpers instead for using the helpers
Release 1.0.0
Core enhancements
- Extend partials to support inline params like #sections
- Section index for lists of objects,$idx in the context
- Section size/length for lists of objects, $len in the context
- Extend grammar to relax whitespace/eol for certain Dust tags
- Support numbers in the inline params
- Extend core support for accessing single dimensional array with [] notation
- Support dynamic blocks, similar to dynamic partials
- Add pipe support for Node.js
- Add support for runnin on V8/rhino
- Extend filters for JSON.stringify and JSON.parse
- Jasmine for unit tests
- Travis CI for continuos build and Cover for code coverage report
Bug fixes/ perf improvements
- Fix to support > node0.4
- Fix to peg.js to print the line and column number for syntax errors in dust templates
- Improved compile times by 10X by optimizing the way we used the peg parser
Extensions and helpers
- Simple logic/branching helpers with @select/ @eq/ @lt etc
- Versatile @if helper relies on the eval for complex expression evaluation, Here are the perf results for eval http://jsperf.com/dust-if. Use with caution, since eval is known to be slow.
Installation
For LinkedIn Dust
$ npm install dustjs-linkedin
For LinkedIn Dust helpers
$ npm install dustjs-helpers
To render compiled templates in the browser:
<script src="dust-core-1.0.0.min.js"></script>
To compile a template on the command line, use the dustc command. Its syntax is:
dustc [{-n|--name}=<template_name>] {inputfilename|-} [<outputfilename>]
For example, to compile a template on the command line and have it registered under the same name as the source file:
$ dustc template.html
You can customize the name under which the template is registered:
$ dustc --name=mytemplate template.html
Running Tests
To run tests:
$ make test
To run jasmine tests:
$ make jasmine
Coverage report
To generate code coverage report:
$ npm install cover -g
$ make coverage
To view HTML test coverage report:
$ open cover_html/index.html
Dust.js Code Coverage Report
Minify dust.js
If you need a minified version of Dust, you will find it in the "dist" folder. If the minified files do not exist, you can generate them using
Install all the dependencies to minify with
$ npm install
Perform the actual minification with
$ make min
Guidelines - Contributing to LinkedIn Dust
If you are interested in contributing?
Download
.zip file
Download
.tar.gz file
is maintained by linkedin.
This page was generated by GitHub Pages using the Architect theme by Jason Long.