Closed dazoe closed 12 years ago
Great, thanks, I'll take a look!
Was that for any view, or just with partials? Mac/linux/windows?
*edit: just saw your edit, thanks :)
I think 789296d8f11b374041a3432da22cdf4e51edb27d fixes this.
For now my main assumption is that any relative path from the calling template should work, with or without the extension. I'm also supporting the thing/index.ejs
and _thing.ejs
variants, but note that if you call partial('thing/index',list)
then the variable name for your list items in index.ejs
will be index
and not thing
. If you call partial('thing',list)
it will find thing/index.ejs
and your variable will be called thing
. Seems right to me, but it caught me when I was adapting the tests.
I removed some of the variants of partial path that were previously only kind-of supported, because we're not testing them (yet). If there are other ways you'd like to find partials let me know and I can add them back in.
I've made it clearer that the lookup
function is just for partials (the Express 2 version that it's based on was for all view paths) so that should help with future maintenance.
Also, I just spotted a problem with my error handing. I was not passing errors back correctly from templates without layouts. This made it much harder to track down simple template bugs. Should be fixed, and all this is published to npm.
If i try to use a slash in a view name it silently fails. Took a while just to figure out what had happened. need to handle errors better. and allow slash in view name. but other than that this is lookin good! *edit: when using partials.