express-ejs-layouts
express-ejs-layouts copied to clipboard
Support for recursive layouts
Say you have a base layout you want to be applied to all pages, but you also have a sub-layout that contains a little extra bloat (such as some extra css files) which is also shared between a few more pages.
Is there any way for this to be achieved?
<!-- base-layout.ejs -->
<html>
<body>
<nav>Some nav</nav>
<%- body %>
</body>
</html>
<!-- sub-layout.ejs -->
<div>SOME PAGE BANNER</div>
<%- body %>
<!-- page.ejs -->
<h1>Page Title</h1>
Expected output
<html>
<body>
<nav>Some nav</nav>
<div>SOME PAGE BANNER</div>
<h1>Page Title</h1>
</body>
</html>