visionmedia/express — pull request #1389 by hermanjunge (2012-10-28 07:18:18+00:00)
Title: Add view lookup paths

Solves #533

* Default behaviour persists, you can still work with just one views directory, by setting it to app.set('views', myDirectory + 'views');

* Add directories using `app.viewPaths.push(myViewsDirectory);`
* No other function where added, if you want to remove a `viewPath`, you must manipulate the array.
* No tests where added, need to check if this is the expected behaviour and functionality.

Personal Notes: I spent a great deal of time trying to enable this functionality without touching express' code:

1. First by reading the code and the docs (hope I haven't missed the typical obvious reference and the feature existed :P).
2. Then I tried to create a proxy on `app.render` by issuing an .apply(). Problem with this approach is that you need to clone the `app` object of express if you want to keep the global setting `views` stable.
3. Then I started to think on creating my own lib `app.render()` as an override to the one of express (well, more of a 4 liner constructing View and issuing the call to render()), but any future change to express could be a nightmare to maintain.
4. Then I stumbled over this open issue, I forked, coded and I'm in this PR.... So please guys, it'd be so nice having it as a feature of 3.0.x :D

If that is what you need, let me know, to update the gh-page and related docs. If not, let me know also, to have this done ASAP.

H.-