js的壓縮與混淆

使用yuicompressorjs的壓縮:css

tar xf jdk-7u45-linux-i586.gz java

chmod 775  jdk1.7.0_45linux

mv jdk1.7.0_45 /usr/local/javaide

ln -s /usr/local/java/bin/java /usr/bin/ui

mv yuicompressor-2.4.8.jar /opt/this

 

java -jar yuicompressor-x.y.z.jar --preserve-semi -o output.js input.js  編碼

 

java -jar /usr/local/src/yuicompressor-2.4.8.jar -o ad.min.js ad.js  spa

 

參數說明:orm

-h, --help Displays this information  幫助信息
--type <js|css> Specifies the type of the input file  壓縮類型
--charset <charset> Read the input file using <charset>   文件使用的字符集編碼(如--charset utf-8
-v, --verbose Display informational messages and warnings   顯示詳細信息和警告信息
-o <file> Place the output into <file>. Defaults to stdout.      輸出文件,默認爲標準輸出 ip

--preserve-semi Preserve all semicolons表示保留分號

 

使用packer2js的壓縮:

packer2.perl 安裝:

unzip  packer2.perl.zip  -d /opt/packer2

 

cd /opt/packer2/

perl jsPacker.pl -i input.js -o output.js -e62  


-e是混淆的程度 
[0=None 10=Numeric 62=Normal(alphanumeric) 95=High-ascii] 
通常使用62便可 

相關文章
相關標籤/搜索