Introducing a very popular JavaScript compression tool YUI compressor, can provide better compression efficiency, the tool is produced by the famous Yahoo Exceptional performance project team.
Jsmin is very popular, simple, but according to Yui Compressor's instructions, jsmin compression algorithm is relatively simple, may shed a lot of newline; Yahoo engineer that Yui Library do test, found Yui compressor compression effect than jsmin good 20%; Of course, Yui compressor A disadvantage is based on JAVA, first you need to have a JRE to run, Jsmin provides EXE downloads directly under Windows, and also offers c/java/c#/perl/php/even JavaScript version J for easy use by various programmers in all environments; Download Yui at this address compressor:http://developer.yahoo.com/yui/compressor/
Steps to use:
1. Installing the Java Environment
2. Place Yuicompressor.jar in any directory, such as/opt/software/yuicompressor/yuicompressor.jar
3. Write the bash script, save as Yui.sh
#!/usr/bin/env Bashjava-jar/opt/software/yuicompressor/yuicompressor.jar $ > $
4. Run the command to make yui.sh executable
# chmod +x/opt/software/yuicompressor/yui.sh
5. Create a link
# sudo ln-s/opt/software/yuicompressor/yui.sh/usr/bin/yui
6. How to use
# Yui Old.js New.js
The first parameter is the original uncompressed file, the second parameter is the compressed file
Yui-compressor installed and used under Linux