visionmedia/consolidate.js — pull request #86 by manuelbieh (2013-01-13 16:10:33+00:00)
Title: Partials ignore express' views folder

Following situation:

**Appfolder/app.js:**

app.engine('html', cons.handlebars);
app.set('views', __dirname + '/views');

[...]
res.render('account/edit', {partials: {
head: '_head'
}});
[...]

→ Consolidate looks for `Appfolder/views/account/_head.html` instead of `Appfolder/views/_head.html` which is the default views folder we defined earlier.

This is in my eyes pretty unfavorable because we don't have a chance to define "default" partials using app.locals() since the folder consolidate is looking for templates differs for every view and depends on the folder the currently compiled template is placed in.

In my version consolidate checks if a default `views` folder was defined and if so, loads the partials from there instead of from the current path.

`app.locals({partials: {head: '_head'}});` then always looks for `Appfolder/views/_head.html` and ignores the current working dir which makes life much easier.