diff --git a/sitegin/nunjucks.js b/sitegin/nunjucks.js index 7534dffe2c63d9497ebc4398cf4f8aed8e590b62..328d4adced27e145b305069d37caed425bfeef67 100644 --- a/sitegin/nunjucks.js +++ b/sitegin/nunjucks.js @@ -36,7 +36,11 @@ env.addFilter('paginationList', function(page, count) { }); env.addFilter('inspect', function(obj) { - return util.inspect(obj); + return util.inspect(obj); +}); + +env.addFilter('log', function(obj) { + return console.log(obj); }); env.addFilter('relURL', function(filename, dir){ @@ -53,6 +57,13 @@ module.exports = function(data, type) { resolve(tmpl); }); }).then(function(tmpl) { - return tmpl.render(data); + return new Promise(function(resolve, reject){ + tmpl.render(data, function(err, val) { + if(err) { + reject(err); + } + resolve(val); + }); + }) }); }