I want to use underscore function in jade template, like this
p= _.keys(user)
Not for client javascript, for in redering.
Through I did require ‘underscore’ in app.js, did not get along well.
Of course it work properly in app.js.
ReferenceError: xxxxxxx _ is not defined
this is template error message.
any idea?
thanks
If you are using Express.js (presumably you would be since you’re using Jade) you can add underscore as a view helper.
UPDATE Using Express 3+, the above will no longer work, use
app.localsinstead: