RandomEtc / ejs-locals

Express 3.x layout, partial and block template functions for the EJS template engine.
298 stars 63 forks source link

Doesn't work with express3.0.0rc3 #5

Closed yuri-karadzhov closed 12 years ago

yuri-karadzhov commented 12 years ago

It works fine with express3.0.0rc2 but when I update the project to new express3.0.0rc3 I've got an error

TypeError: Cannot read property 'blocks' of undefined at View.module.exports [as engine] (/var/www/lib/node_modules/ejs-locals/index.js:65:22) at View.render (/var/www/lib/node_modules/express/lib/view.js:75:8) at Function.app.render (/var/www/lib/node_modules/express/lib/application.js:504:10) at ServerResponse.res.render (/var/www/lib/node_modules/express/lib/response.js:677:7) at exports.index (/var/www/lib/routes/routes.js:271:7) at callbacks (/var/www/lib/node_modules/express/lib/router/index.js:165:11) at param (/var/www/lib/node_modules/express/lib/router/index.js:139:11) at pass (/var/www/lib/node_modules/express/lib/router/index.js:146:5) at Router._dispatch (/var/www/lib/node_modules/express/lib/router/index.js:173:5) at Object.router (/var/www/lib/node_modules/express/lib/router/index.js:33:10)

gustavohenke commented 12 years ago

I'm having the same issue here.

RandomEtc commented 12 years ago

This should be fixed in v0.1.5. TJ changed Express so that there's no options.locals by default when the template engine is called. The EJS render call still uses options.locals so this library creates it now if it doesn't already exist, and then uses as before. This should be backwards compatible with other versions of Express 3.x, but I'm glad we're onto release candidates now!

tomafc330 commented 12 years ago

Verified using Express 3 rc3 and version 0.1.5