Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helpersPath doesnt work with jade templates #1592

Closed
hochitom opened this issue Apr 24, 2014 · 3 comments
Closed

helpersPath doesnt work with jade templates #1592

hochitom opened this issue Apr 24, 2014 · 3 comments
Labels
documentation Non-code related changes non issue Issue is not a problem or requires changes

Comments

@hochitom
Copy link

when i define a a helpersPath i get undefined is not a function when requesting a page.

views: {
        path: __dirname + '/views',
        helpersPath: __dirname + '/helpers',
        partialsPath: __dirname + '/views/partials',
        engines: {
              jade: 'jade'
        },
        compileOptions: {
              pretty: true
        },
        isCached: false
}

i named my helper file test.js and exported a simple function

module.exports = function () {
      return 'hallo';
};

and in my template i called the function test()

i'm not quite sure if i made a mistake when implementing it, or if its an jade related issue.

@hueniverse
Copy link
Contributor

Does jade support helpers via the registerHelper() method?

@hochitom
Copy link
Author

i did a quick research and found out that jade does not provide a registerHelpers function. jade expects all the helpers in the local scope. this explains why that was the only way to add i18n support:

req.response.source.context.__ = function (string) {
    return i18n.__(string);
};

@bf
Copy link

bf commented Nov 26, 2015

Issue still persists with current Jade version :-(

@lock lock bot locked as resolved and limited conversation to collaborators Jan 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Non-code related changes non issue Issue is not a problem or requires changes
Projects
None yet
Development

No branches or pull requests

3 participants