ericf / express-handlebars

A Handlebars view engine for Express which doesn't suck.
BSD 3-Clause "New" or "Revised" License
2.31k stars 382 forks source link

Allow for template specific helpers #135

Open jcreamer898 opened 9 years ago

jcreamer898 commented 9 years ago

Was thinking it'd be cool if for a given template, you can define helpers that back it. For example...

/views/index.hbs
/views/about.hbs

When express-handlebars gets ready to render those templates, it would be cool if you could have...

/helpers/index.js
/helpers/about.js

helpers/index.js

module.exports = {
  foo: function() {
    // ...
  }
};

views/index.hbs

{{foo}}

I'm going to do some source diving myself and see if I can help out with a PR for this type of feature if people think it's a good idea.

Let me know!