dciccale / grunt-processhtml

Process html files at build time to modify them depending on the release environment
MIT License
407 stars 30 forks source link

Way to keep build:template comment in html? #106

Closed arjunkalburgi closed 6 years ago

arjunkalburgi commented 7 years ago

I want to add a line to my html file, and retain the ability to add another line.

So what I've done in my grunt is: image

Where themelink is: image

The problem is processhtml tries to work recursively and attempts to replace the newTheme in themelink string. Naturally there is no other newTheme for it to grab, so I get a newTheme not defined warning and thus doesn't run.

Edit: The quote/code styles aren't working, sorry for the lame pictures

dciccale commented 6 years ago

Grunt has a separate template engine, which parses your Gruntfile. So if you have a template string in your grun file with <%= newTheme %> grunt itself will try to replace that. Is not the processhtml plugin doing this.

You could write your template in an html file, and read it in your gruntfile with fs.writeFileSync to prevent Grunt try to replace your template literal.