作用:可以对javascript的大小进行压缩。使javascript的加载速度变快。
用法:
在 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
12345下一页阅读全文
ESC之ESC.wsf可以实现javascript的代码压缩附使用方法第1/5页
2021-05-28 10:01:35声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。 如涉及版权问题,请提交至online#300.cn邮箱联系删除。
热门文章