I'm using grunt
to build a javascript/angularjs
project in the following order:
clean copy > uglify > cssmin
.
Now if I change a js
file I'd always have to manually add a version increment at the end of the script tag, so that the browser can detect the changes.
<script src="/js/myscript?v123"></script>
Question: how can I automate this process using grunt
? If I run the "grunt" command, only files that changed compared to the last run should get a version increment. So that the browser can reuse the cached files as much as possible.
I know short answers are not OK (not enough rep to comment), but you might want to checkout grunt-asset-cachebuster. I haven't tried it myself but there are plenty of examples in their npm page.
Also checkout this answer about grunt-newer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With