Skip to content

pcruz7/browserify-dustjs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

browserify-dustjs NPM Module NPM Module

browserify transform for dust template files

Install

npm install browserify-dustjs --save-dev

Use

var template = require("../views/template.dust");

template({title:"Browserify is Awesome!", mood:"happy"}, function(err, html) {
    // Deal with html
});

template(function(err, html) {
    // Also works without context
});

Transform

To use it from the command line:

browserify -t browserify-dustjs file.js

To use it from node:

var browserify = require('browserify');
var dustify = require('browserify-dustjs');

var b = browserify();
b.add('view.js');
b.transform(dustify);

b.bundle().pipe(process.stdout);

Note that by default browserify-dustjs transforms only .dust and .html files. You can add more extensions:

...
// transform `.dust`, `.html`, and `.tpl` files
b.transform(dustify.configure('.tpl'));
...

or specify all extensions:

...
// transform only `.dust` and `.tpl` files
b.transform(dustify.configure(['.dust', '.tpl']));
...

or both:

...
// transform only `.dust`, `.tpl`, and `.xyz` files
b.transform(dustify.configure(['.dust', '.tpl']).configure('.xyz'));
...

About

browserify transform for dust template files

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%