I have an index.html file with a part that looks like this:
<header>
<nav>
<div id="element1"></div>
<div id="element2"></div>
<div id="element3"></div>
<div id="element4"></div>
</nav>
</header>
I want to define a grunt task that lets me build different versions of this file. This is an example:
<header>
<nav>
<!-- my:task index_v1.html -->
<div id="element1"></div>
<div id="element2"></div>
<!-- endmy -->
<!-- my:task index_v2.html -->
<div id="element3"></div>
<div id="element4"></div>
<!-- endmy -->
</nav>
</header>
This would build
index.html: with the complete contentindex_v1.html: all the markup, but only#element1and#element2includedindex_v2.html: all the markup, but only#element3and#element4included
Notes:
- I noticed grunt-preprocess and this related question, however, I would need to run grunt n times, changing the ENV variables, for each file. I have other tasks as well and I want this to be on a single run.