written at 20:45 by faberman
CSS/JS minify

In need of a simple JS/CSS comment and white space stripper, I found not one useable tool. So, as usual, I wrote my own to strip and pack all CSS/JS into convenient archives. Not only does it reduce page load time and thus improve the user experience, it reduces traffic payload and the number of requests - a small step towards more sustainability for web pages.

USAGE

minify -js [<JS-File>..] minify -css [<CSS-File>..] minify (<file.js> [<file.js>..])|(<file.css> [<file.css>..])

If there are no file names given in -js or -css mode, stdin is used as input.

I use a make target in my projects to create minified and precompressed versions of the JS/CSS files:

minify: rm css/all.css* || true minify -css css/* > css/all.css gzip -fc9 css/all.css > css/all.css.gz rm js/all.js* || true minify -js js/* > js/all.js gzip -fc9 js/all.js > js/all.js.gz

SOURCE

minify_v2.tgz v2, 2020-11-28