Open ricardograca opened 9 years ago
Since most of the time templates are rendered via Express there's no need to do this since Express' View
module will figure out which extension to add if it's missing. If you'd like to add this because you're calling render()
on the Express Handlebars instance, feel free to open a PR for it; you could look into how Express does this for the implementation details.
Great! I'll take a look into in when I have some free time. So, just to clarify, it won't break anything if this functionality is included in the Express Handlebars' render method right?
Correct, it should be possible to add this feature without breaking back-compat.
@ricardograca I've done a refactor of this package and plan to release v2.0 soon which adds support for the newly released Handlebars 3.0. If you're still interested in making this change, checkout #105 and make it against the handlebars-3.0
branch.
Thanks. Will do.
I'm not sure if this is possible, but it would save some typing (and possibly refactoring time in the future) if express-handlebars instance methods used the
extname
setting to figure out the path of the specified template. Right now it seems to be required to pass the full path (relative to the project's root) to the express-handlebars instance methods (for example:getTemplate
,render
):However, by setting
extname
when creating the instance, I expected that instance to know what kind of extension I'm using for templates, so I could do just this:That would just leave the issue of figuring out automatically where the views are located, but that is probably more complicated right?