2016 answer :
If you use express, the layout middleware takes a layout parameter, which may be useful.
res.render('page', { layout: 'mylayout.jade' })
original answer : very few JS libraries implement functionality like extends.
- Nun is a very mustache, but only a server (and is no longer supported)
- Swig is spread, but not very mustache.
- Jade expands and works in the browser, but not a mustache, such as
I settled on Dust.JS , since it uses mustache-like sections, works on the client and server, and supports overlapping blocks on the parent from the child, giving effective support.
See dust documentation, section "Blocks and embedded particles":
{>base_template/} {<title} Child Title {/title} {<main} Child Content {/main}
Overriding the 'title' and 'main' sections from the parent template, preserving the surrounding content.
source share