ESC之ESC.wsf可以实现javascript的代码压缩附使用方法第1/5页_Javascript教程-查字典教程网
ESC之ESC.wsf可以实现javascript的代码压缩附使用方法第1/5页
ESC之ESC.wsf可以实现javascript的代码压缩附使用方法第1/5页
发布时间:2016-12-30 来源:查字典编辑
摘要:作用:可以对javascript的大小进行压缩。使javascript的加载速度变快。用法:在cmd下面输入的东西;cscriptESC.w...

作用:可以对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

当前1/5页12345下一页阅读全文

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新Javascript教程学习
    热门Javascript教程学习
    编程开发子分类