Closed iamdriz closed 8 years ago
:+1: Is there a way to have it wipe the file before adding content? Or do you recommend using another grunt plugin prior to compiling to clear the destination?
Great plugin by the way. Have had this use case for a while now and finally found this!
I'd say wiping the file should be default behaviour and maybe an option to turn it off if someone needs it (although I can't think of a scenario where you would want to do that)
To me, this plugin is no different to compiling CSS or JS and it always wipes the file first before adding the newly compiled code.
Thoughts?
Sent from my iPhone
On 11 Jun 2015, at 19:10, Andrew Wolfe notifications@github.com wrote:
Is there a way to have it wipe the file before adding content? Or do you recommend using another grunt plugin prior to compiling to clear the destination?
— Reply to this email directly or view it on GitHub.
Agree! I can't think of a reason why you would want to append the output, which is why I was curious about the recommendation of another plugin to wipe it first.
FWIW I've started using https://github.com/gruntjs/grunt-contrib-clean to handle that for me.
I agree. For now, you can just change line 229 and set appendToFile
to false
in tasks/compile-handlebars.js
This is the behavior because you may have multiple files that are being appended to during the run. In addition,
If you want to remove files between runs, I suggest grunt-contrib-clean
So I have the following template:
And then I have the following grunt task
However everytime I run it then index.html just gets the content duplicated rather than replaced.
So for example after running the task 3 times one after the other, the index contents are:
How do I stop this? It should replace the contents rather than append to it.
Also how come the footer is on a new line, but the content ends up on the same line as the header?