用法:
在 cmd下面输入的东西;
cscript ESC.wsf -l 3 -ow ../global.js global.js
上面是一个简单的例子:可以自己建一个bat文件放在当前目录下面
cscript ESC.wsf -l 压缩级别 -ow 。。/要压缩到那个目录 需要进行压缩的原js
1.
Level 0 :: No compression //没有处里
Level 1 :: Comment removal //删除掉注释
Level 3 :: Newline removal //删除掉新行
Level 4 :: Variable substitution //变量的替换
2.下图时所用到的参数:
-l 级别
-s
-v
-$
-oa 以追加的形式覆盖
-ow 以覆盖的形式覆盖
所用压缩包在附件 还有帮助文档
使用的例子见压缩包中的图片。
下载地址 http://xiazai.jb51.net/201003/yuanma/ESC.rar
Introduction
ESCisanECMAScriptpre-processorwritteninJScript,enablinganunlimitednumberofexternalscriptstobecompressed/crunchedintosupertight,bandwidth-optimizedpackages.Featuringseveralcompression-techniquessuchascommentremoval,whitespacestripping,newlinestrippingandvariablesubstitutionESCcanreducetheoverallsizeofyourcodewithupto~45%.Single,multiplescriptsandevendirectorieswithscriptscanbemergedtogetheratthecompressionlevelyoudecide.Theprocessedoutputcanlaterbeappendedorwrittentoafile,orpipedtoanotherapplicationforfurtherprocessingviaSTDOUT. ESCdoNOTsupportcrunchingofinlinescripts.SoanyattemptpassingHTML,ASP,JSP,PHPorotherequivalentdocumentstoESCisdoneatyourownrisk. ESCsupportsfourlevelsofcompression,whereahigherlevelequalshighercompression.Bewarethoughthatlevels>2requiresyourcodetobesyntaxicallyperfectorESCwillpunishyoubyproducingabrokenanduselessoutput. Thecompressionratioshouldhitaround25%usingthedefaultcompressionlevelonavanillalookingscript,butresultsashighas~45%canbeachieveddependingonthescript'sdesign/yourstyleofwritingcode. ESC'scompressionengineisintelligentinthemeaningthatithaslanguagesyntax,statementandkeywordawarenessandit*knows*aboutnativeobjectsandmembersprovidedbythemostcommonscriptinghosts.Thisknowledgebasecaneasilybeextendedbypluggininuserdefinedmapswithadditionalinformationtofurthergaincontrolofthecrunchingprocedure.Duringprocessingfollowingthingsaretakenintoaccount: StringandRegExpressionread-ahead
JScriptConditionalcompilationstatementsandvariables
ECMA-262Corelanguagedefinitions(ECMAScript)
IntermediateDOM's(level0)andDOMlevel1
MSJScriptspecificobjects/methods
Netscape/Mozilla/Operaspecificobjects/methods/properties
MSWSH(WindowsScriptingHost)1+nativeobjects
当前1/5页12345下一页阅读全文