quangv / hulk-hogan

Hogan.js for Express with support for Template Partials.
MIT License
37 stars 2 forks source link

Does't work in express 3.0 #10

Closed ghost closed 12 years ago

ghost commented 12 years ago

I put

  app.engine('hulk', require('hulk-hogan').__express)
  app.set('view engine', 'hulk');
  app.set('views', __dirname + '/views');

in app.js, and when rendering outputs:

TypeError: Object #<View> has no method '_readFile'
    at View.HulkHogan.__express [as engine] (/home/boris/Dropbox/projects/tales/node_modules/hulk-hogan/hulk.js:110:21)
    at View.render (/home/boris/Dropbox/projects/tales/node_modules/express/lib/view.js:75:8)
    at Function.app.render (/home/user/test/node_modules/express/lib/application.js:502:10)
    at render (/home/user/test/node_modules/express/lib/response.js:663:9)
    at ServerResponse.res.render (/home/user/test/node_modules/express/lib/response.js:687:5)
    at index (/home/user/test/controllers/site.js:6:9)
    at callbacks (/home/user/test/node_modules/express/lib/router/index.js:166:11)
    at param (/home/user/test/node_modules/express/lib/router/index.js:140:11)
    at pass (/home/user/test/node_modules/express/lib/router/index.js:147:5)
    at Router._dispatch (/home/user/test/node_modules/express/lib/router/index.js:174:5)

Is there anything I made a mistake?

quangv commented 12 years ago

using Dropbox for project folder, Nice!

hmm I don't currently use Express 3.0

@christopherscott contributed the Express 3.0 part, Christopher, if you can read this, what is the right set-up for Express 3.0 ?

Also @analysis918 what version of node are you using? I haven't tested this with Node > 0.6 ...

quangv commented 12 years ago

_readFile is a method of the main hulk-hogan object, perhaps the __express method needs an => instead of an -> ...

ghost commented 12 years ago

Thanks quangv.

I use dropbox for backup somtimes and my node version is v0.8.1.

I am having a look at coffee, maybe you are right.

christopherscott commented 12 years ago

@analysis918: your code to setup hulk-hogan seems perfect

@quangv: yeah i agree try using fat arrow for _readFile definition. I don't have time to test right now (at work), but that's where I'd start (also, should other methods use fat-arrow as well, since now they're all members of HulkHogan class? seem to be using '@' in a lot of places - just a thought...)

christopherscott commented 12 years ago

submitted a pull-request that should address this error: issue #11 https://github.com/quangv/hulk-hogan/pull/11

quangv commented 12 years ago

@analysis918 Thanks for the bug report.

@christopherscott Thanks for the bug fix. Merging it in now. Also adding you as a contributor. :)

Also about =>, yeah I try to use them as little as I can... I'm not sure why exactly, maybe just a compulsive/obsessive thing... ;)

quangv commented 12 years ago

@christopherscott please correct email if you choose in package.js :)