The minification of static file bundles is an useful process to improve the performance of the client side of web applications.
YUI Compressor is a Java tool, therefore we need the Java Runtime Engine to be installed in the system.
The minified file will be generated with the same name than the original appending the extension
#!/bin/sh # Filtering pattern PATTERN=\.js$ # Directory to find the files (recursive). DIR=$1 list=`find $DIR | egrep $PATTERN` for i in $list do java -jar yuicompressor-2.4.2.jar $i -o $i.mymin.js echo generated $i.mymin.js done
sh minify.sh /var/wwwroot/development/libsjs