0

Basically I need a way to inherit one HTML template(file) from another. The way I see it: parent.html:

<h1><!-- header --></h1>

<div class="container">
  <!-- container -->
</div>

child.html:

<!-- extends: ./parent.html -->

<!-- <header> -->
Child Page
<!-- </header> -->

<!-- <content> -->
<span>Content</span>
<!-- </content> -->

Total duplicate of master page feature available in ASP .NET MVC or layouts of RoR.

Can anyone point me to a library that does something similar? (I going to use it as a loader for webpack, so if there is already a loader for this it would be perfect).

Sergey Sokolov
  • 2,709
  • 20
  • 31

1 Answers1

1

I recommend Nunjucks from Mozilla. You can use it via NPM or browser, also it is compiled.

https://mozilla.github.io/nunjucks/templating.html#template-inheritance

cetver
  • 11,279
  • 5
  • 36
  • 56