ejs
ejs copied to clipboard
options.scope no longer has effect in render
test='this test in base'
console.log(ejs.render('<%= this.test %>'))
console.log(ejs.render('<%= this.test %>',{scope:{test:'in scope'}}))
produces
this test in base
in scope
in [email protected], both lines produce this test in base
This appears to be the result of https://github.com/visionmedia/ejs/pull/79 which wraps the template code in a function(){...}().
Using option._with:false, gets around this problem
I think this issue would be resolved by changing the template compile to produce
(function(){...}).call(this)
In other words, pass the scope through the new function layer.