Static HTML compilation with partials using Grunt.js

AVP picture AVP · Aug 16, 2013 · Viewed 9.2k times · Source

I've been looking all over for something that will let me precompile static websites using Grunt. It needs to have partials, so I can include things like a common header/footer across the pages.

So far, I've only really found Jade, which has a grunt plugin, and this plugin for Grunt that compiles Dust.js templates to static HTML. I don't really like Jade's syntax, and the Dust plugin for Grunt is less than ideal.

Are there any static HTML templating languages with Grunt/Gulp support that don't deviate too much from regular HTML, and are still active?

Answer

Daniel Kaplan picture Daniel Kaplan · Aug 31, 2013

I found this plugin named grunt-includes. I've been looking for an answer to your question forever. This is the first one I've seen that seems easy to use. All the others seem to maybe have this feature but do 20x other things so they seem like the wrong tool for the job.

The one thing this is missing for me is the ability to prefix relative paths. I'm talking to the developer of modest which is becoming a better option.

UPDATE: There's a grunt-includes-replace that is almost as simple and can prefix relative paths. IE: it lets you pass in variables.