Closed daslicht closed 8 years ago
According to the manual the Envigronment should be automatically created if not defined, no? :
https://github.com/rotundasoftware/nunjucksify#caring-for-the-environment
Hm, yes seems like that should work at first glance. Can you let us know what version of nunjucks you are using so we can reproduce?
In the mean time as a work around you could try giving nunjucks an evnironment
var $ = require( 'jquery' )
var nunjucks = require('nunjucks');
nunjucks.env = new nunjucks.Environment( null, { autoescape : false } );
var tmpl = require( './myWidget.nunj' );
console.log( tmpl.render( { menu : 'chorizo' } ) );
"nunjucks": "^2.4.1",
I also ran into this issue. Any advice would be helpful!
Hi @aboutaaron ,
Nunjucksify is in a funny state right now because of https://github.com/mozilla/nunjucks/issues/507 . That issue was resolved with the merge of https://github.com/mozilla/nunjucks/pull/753 , but we are still waiting for the next nunjucks release before we can update the dependency and resolve the funniness in nunjucksify.
In the mean time I recommend using the following in your package.json
{
"dependencies": {
"nunjucks": "git://github.com/dgbeck/nunjucks#68a456b3d80a0961f4fab8bc79c5c8a4e304246a",
"nunjucksify": "git://github.com/rotundasoftware/nunjucksify#89b2dc5204560f819278320bca04751fbb24bbb9",
...
}
}
When using those versions of nunjucks / nunjucksify, everything should work as expected.
Closing this issue for now. Let me know if you continue to have problems.
Thanks for stopping by!
please keep us posted on this issue
Hi, I I have the following setup:
test.js
myWidget.nunj:
package.json:
bundle include:
I get the following error in the browser:
Uncaught TypeError: nunjucks.Environment is not a function
What do I miss , please?