-
-
Save seriousManual/8313206 to your computer and use it in GitHub Desktop.
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
//whitespaces added for clarification | |
(function(){ | |
dust.register("intro",body_0); | |
function body_0(chk,ctx){ | |
return chk.write("Hello ").reference(ctx._get(false, ["name"]),ctx,"h").write("!"); | |
} | |
return body_0; | |
})(); |
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 fs = require('fs'); | |
var dust = require('dustjs-linkedin'); | |
var tmplSource = fs.readFileSync(__dirname + '/intro.js').toString(); | |
var tmpl = createTemplate(tmplSource, 'intro'); | |
tmpl({name: 'fooobar'}, function(error, result) { | |
console.log(arguments); | |
}); | |
function createTemplate(tmplSource, name) { | |
dust.loadSource(tmplSource); | |
return function(data, callback) { | |
dust.render(name, data, callback); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment