Scenario: I use a simple function to minify and compress JS files during the deployment like this:
for i in public/js/*.js; do uglifyjs --overwrite --no-copyright "$i"; done
The problem with this approach is that it minifies and overwrites original files. I would like to somehow introduce a versioning of minified JS and CSS files.
Let’s say I have a variable with the version: “123”. How to modify my script to write files with this version? It should work with CSS and JS files like this:
style.css -> style.123.css
script.js -> script.123.js
should work in sh too: