Google Closure Compiler压缩javascript代码施用

Google Closure Compiler压缩javascript代码使用

首先从网上下载代码:

windows系统:http://closure-compiler.googlecode.com/files/compiler-latest.zip

liunx系统:

#wget http://closure-compiler.googlecode.com/files/compiler-latest.zip
#unzip compiler-latest.zip
解压后会看到 complier.jar文件,主要引用此jar包进行压缩,使用如下命令进行压缩JS:

E:\google js complier>java -jar compiler.jar --js common.js --js_output_file com
mon_compiler.js
这样就把 common.js 压缩成了 common-compiler.js。