ericalli / static-site-boilerplate

A better workflow for building modern static websites.
http://staticsiteboilerplate.com
MIT License
1.74k stars 163 forks source link

Use a templating/include engine #51

Closed Aditya94A closed 4 years ago

Aditya94A commented 4 years ago

Going by this project means you just keep making more html files. That works fine if you have maybe two or three, but if you have dozens, that means that if you want to change the <head>/<footer>/<nav> on your website then you have to change it in every single file manually, which is insane.

Any mature static site setup should have a templating/partials/include engine setup.

https://www.staticgen.com/

ericalli commented 4 years ago

Actually, interpolate: true is configured as an html-loader options, so it's easy to add simple partial rendering like so:

Create a partial like:

_header.html

Require them in your template like:

${require('./_header.html')}

No templating engine needed :)

The upcoming version of Static Site Boilerplate will have enhanced support for templating engines using the preprocessor option.