The code below throws the error: tmpl.render is not a function(…)
helloworld.nunj
app.js
var tmpl = require("./helloworld.nunj");
console.log("HelloWorld tmpl:", tmpl);
tmpl.render({person:"World"});
The output of tmpl is a function that looks like this:
function (ctx, cb) { return nunjucks.render("PATH_TO_NUNJ_FILE", ctx, cb); }
I can actually get the template to render, by treating it as a function:
var tmpl = require("./helloworld.nunj");
tmpl({person:"World"});
However, if I don't use nunjucksify, I can get the expected result:
var nunjucks = require('nunjucks');
var tmpl2 = new nunjucks.Template('Hello {{ person }}');
tmpl2.render({person:"World"});
Any thoughts?
The code below throws the error:
tmpl.render is not a function(…)helloworld.nunj
Hello {{ person }}app.js
The output of tmpl is a function that looks like this:
I can actually get the template to render, by treating it as a function:
However, if I don't use nunjucksify, I can get the expected result:
Any thoughts?