Helps you to generate a source archive for your CSS/JavaScript files.
Compressing multiple CSS/JavaScript files in just one archive will speed up your website because it will lower the transfer volume and does minimize the number of requests.
If you're using Makefiles (or anything similar) to automate building and synchronizing your website, srcar will fit in just nicely:
OBJECTS = css \
js \
*.html .ht* *.txt
PRODUCTION = user@host:path/to/htdocs/
OPTIONS = --recursive \
--links \
--update \
--delete-after \
--times \
--compress
production: css js
cd htdocs && rsync $(OPTIONS) \
$(OBJECTS) \
$(PRODUCTION)
css:
srcar \
header.css \
article.css \
footer.css \
body.css
js:
TYPE=js COMPRESSOR='java -jar compiler.jar' srcar \
App.js \
main.js
For CSS, there's a compressor in perl and BASH included. Find alternative implementations here:
https://github.com/markusfisch/csspack
If you want to use something different (like a CSS preprocessor), just assign the COMPRESSOR environment variable accordingly beforehand (look at the JavaScript section above).
For compressing JavaScript, you'll need to find an external compressor. The above sample does use the Google Closure Compiler: