Minify_recursive is a shell script that uses YUICOMPRESSOR to minify all css and js files recursively in a directory.
The only requirement is to install YUICOMPRESSOR https://github.com/yui/yuicompressor
- Configure path to YUICOMPRESSOR_PATH by editing the minify_recursive.sh file
- Create a soft link of minify_recursive script in /usr/local/bin
ln -s minify_recursive.sh /usr/local/bin/minify_recursive
- Give execute permission to minify_recursive script
chmod +x minify_recursive.sh
I had a project and wanted to create a git pre hook to recursively minify all files in my project. Hence this small script came into existence. It does 1 thing and does it pretty well for me. Minify all files in a directory and put it in minified directory.
I have throwed this shell script into /usr/local/bin
minify_recursive css # This will recursively minify all css in your pwd (present directory)
minify_recursive js # Recursively minify all js file in pwd
minify_recursive js /var/www/html/myproject # This will recursively minify all js file in myproject directory.
If your using drupal like me, you can use
- hook_js_alter($javascript)
- hook_css_alter($css)