Given a sample structure:
Is there any way I can extend layout.jade in example.jade without having to keep track of the number of parent directories?
This works as intended tho:
But it would be preferable to do something like:
Or even alias/hardlink and use it like:
Also assuming somebody knows a solution, can it also be applied to include?
There is a change that was introduced in this particular commit.
Basically, if the first character found in the include statement is a forward slash and basedir is defined, it will look for the template in that path.
You must first setup Jade:
app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); app.locals.basedir = app.get('views');
Then, from any template, no matter how deeply nested, you can do:
This recipe can be found in it's original form on Stack Over Flow.