Conversation
Adds a new private function _getView, that - if viewsPath is an array - compares it to viewPath stripped of the filename, and then does the usual _getTemplareName().
lib/express-handlebars.js
Outdated
|
I'm actually wondering if getting the view's "name" (the value passed to I'm not sure what should be considered the best match. We can use |
lib/express-handlebars.js
Outdated
There was a problem hiding this comment.
Yeah, this is why we need a criteria for determine the best match. Should we go with, the file must exist in the dir, and have the shortest length to be the winner?
|
Ah, so if there happen to be multiple .handlebars files named the same thing in different views? Perhaps an error message asking one of them to be renamed, or giving each a unique name, e.g. |
Something like this? path.normalize should take care of the backslash issue, but I'll see if I can test it tomorrow as well.
|
If you have the following views dirs:
And the view that's being rendered is at: Using
Using
So the question is which one of these do you pick? Is it simply the shortest one? I think that in this case it would be reasonable to pick |
|
Yeah, that's why I used the strip-filename regex. With those three views dirs, you'd only get one possibility: |
Nope it can't because no matter what's specified to |
|
Is this fixed? |
|
Taking a step back: much of this would be resolved if |
|
Is there any update/decision on this? Restricting to a single views folder is really quite limiting. |
|
Just ran into this issue today as well, would also like to know if there are any updates. |
|
I really need this feature too. @ericf are you planning to merge this? are you waiting for something? |
|
Also really need this feature. I noticed after going through express-handlebars.js that nothing seems to need the My question is: Is there any reason I shouldn't be pulling out the view property of the options object? |
|
Any updates on this? Did anyone cloned this repo and merged this...? |
|
Development has moved to https://github.com/express-handlebars/express-handlebars/ if you would like to create a PR on that repo we could add this. |
Fixes #124.
I've added a fix based on your help, and now when views is an array, res.render checks both folders (I've tested). I've tried to match the existing codebase/style as closely as possible, but there's probably still a few things you can fix (like the
_getViewcomment).Hope it's good enough!