Created
October 26, 2015 20:32
-
-
Save tomalex0/51e7edd08306add9eaff to your computer and use it in GitHub Desktop.
Compile dust file in nodejs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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