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

Including a file multiple times does not re-build the file #114

Open skylarmb opened 6 years ago

skylarmb commented 6 years ago

I would like to define a template html file with variables in it, then include it multiple times with different variables during the build. The issue is the first time a file is included with build:include, the contents of the file is processed and included correctly. I then update the variables and include the file again, but it just included the same content as was generated by the first time it was built. Is there some caching going on or something?

Example:

template.html

<!-- build:template
<p>my_var is: <%= my_var %></p>
/build -->

index.html

<!-- build:template
<% my_var="foo" %>
/build -->
<!-- build:include template.html -->
<!-- /build -->

<!-- build:template
<% my_var="bar" %>
/build -->
<!-- build:include template.html -->
<!-- /build -->

result:

<p>my_var is: foo</p>
<p>my_var is: foo</p>
dciccale commented 6 years ago

Could you provide your grunt configuration or how are you processing the files?

A runnable example would be best so I can reproduce the issue.

skylarmb commented 6 years ago

Simplified example: https://github.com/skylarmb/grunt-processhtml-example

just npm install && npm run build and check out the output in _build/index.html