Trying to render browserify+nunjucksify
-ed precompiled templates in a an ampersand-view
.
This works as expectd:
var tpl = require('app1/template-1.nunj');
console.log(tpl.render({name: 'flemming', isDancing: 'perhaps'}))
This does not:
var MainView = View.extend({
template: tpl.render,
bindings: {
'model.name': '[data-hook=name]'
}
});
The error i get is
Uncaught TypeError: Cannot read property 'dev' of undefined
AFAIK, this means that the this
for the nunjucks is wrong. Ampersand-view
sets itself as this
for the rendering function, overshadowing what nunjucks expects this
to be.
Any solutions?