DustJS Renderer for ExpressJS
Switch branches/tags
Nothing to show
Pull request Compare This branch is 2 commits ahead, 2 commits behind davglass:master.
Latest commit f571989 Nov 30, 2012 @swider swider #3 - Add win32 to OS list
Failed to load latest commit information.
examples Initial Import Mar 7, 2011
lib Add support for dynamicHelpers May 28, 2012
LICENSE Initial Import Mar 7, 2011
README.md Fixed link in README Mar 7, 2011
package.json #3 - Add win32 to OS list Nov 30, 2012


Dust Template Engine for ExpressJS

This express module allows you to use Dust as your template engine.


npm install express-dust

Async Rendering

Express does not support async rendering, so with this module installed you will only be able to use Dust as your renderer in your app. We have to override the render/partial methods on the prototype of the ServerResponse object in order to support the async nature of Dust.

If the callback is ommitted to render/partial the response will automatically be passed to res.send when the Dust operation is completed.


There is a simple example included in this repo under ./examples.


var app = require('express').createServer();
var dust = require('../lib/dust');

//Sets up Global Variables to be used in all views
    copy: '© 2011 Nobody LLC'

app.get('/', function(req, res, next) {
    res.render('index', {
        //Local Variables for this view
        title: 'This is a test'



<!DOCTYPE html>
    <meta charset="utf-8">
    <title>{+title}My Site{/title}</title>

<div id="footer">{+copy}Copyright{/copy}</footer>



{<title}Foo {title}{/title}

    <p>This is my index.dust main body {title}</p>