Skip to content

Instantly share code, notes, and snippets.

@tomalex0
Created October 26, 2015 20:32
Show Gist options
  • Save tomalex0/51e7edd08306add9eaff to your computer and use it in GitHub Desktop.
Save tomalex0/51e7edd08306add9eaff to your computer and use it in GitHub Desktop.
Compile dust file in nodejs
var dust = require('dustjs-linkedin');
var fs = require('fs');
fs.readFile('file.dust', function (err, file) {
var tmpl = dust.compile(file.toString(), "hello");
dust.loadSource(tmpl);
dust.render("hello", { version: dust.version }, function(err, out) {
if(err) {
console.error(err);
} else {
console.log(out);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment