dust.js - Loading partials with dust express -


how can load partial view dust server-side rendering. have tried

{>"../partials/head"/} 

which gets removed rendered output.

the view folder structure like

views     pages         main.dust     partials         head.dust 

i using following package https://github.com/krakenjs/adaro

dust doesn't understand filesystem layout-- string renderer.

if want dust try load templates other locations, should write loader help. attach loader hook dust.onload.

a loader looks this:

dust.onload = function(templatename, callback) {   // path calculation maybe   fs.readfile(templatename + '.js', { encoding: 'utf8' }, function(err, data) {     callback(err, data); // node-style callback   }); }; 

when invoke partial {> "../partials/head" /}, function invoked ../partials/head first argument. can use path , fs methods load correct file , pass callback.

more information: http://www.dustjs.com/guides/onload/


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -