Example #1
0
/**
 *	Render 
 */
 function render(article, next) {

 	article.cache = true; // Enable caching
 	
 	// You could lookup the template based on the article style
 	cons.dust('lib/types/templates/article.html', article, next);

 }
Example #2
0
 'fn': function () {
     var content;
     consolidate.dust(path.join(__dirname, 'views/includes/dust.html'), getData(), function (err, html) {
         if (err) {
             console.log(err);throw err;
         }
         content = html;
     });
     if (!content) {
         throw new Error('dust sync error');
     }
 }
pages.forEach(function(page) {

	cons.dust('views/'+page+'.dust', { views: __dirname+'/views'}, function(err, html) {
		if(err) return console.log('error: ', err);

		fs.writeFile(__dirname+'/dist/'+page+'.html', html, function(err) {
			if(err) return console.log('error saving file: ', page, err);

			console.log('create page: ', page);
		});
	});

});
Example #4
0
function doCache(callback) {
    var now = 0;

    function ok(err) {
        if(err){
            console.log(err);throw err;
        }
        ++now;
        if (now === 6) {
            callback();
        }
    }

    xtpl.renderFile(path.join(__dirname, 'views/includes/xtpl.html'), getData(), ok);
    jade.renderFile(path.join(__dirname, 'views/includes/jade.jade'), getData(), ok);
    ejs.renderFile(path.join(__dirname, 'views/includes/ejs.ejs'), getData(), ok);
    consolidate.dust(path.join(__dirname, 'views/includes/dust.html'), getData(), ok);
    consolidate.handlebars(path.join(__dirname, 'views/includes/handlebars.html'), getData(), ok);
    nunjucks.render('nunjucks.html', getData(), ok);
}
Example #5
0
 const renderBody = function(callback) {
   if (data.body) {
     return callback(null, data.body);
   }
   cons.dust(template, data, callback);
 };