ESC之ESC.wsf可以實(shí)現(xiàn)javascript的代碼壓縮附使用方法第1/5頁(yè)
更新時(shí)間:2007年05月07日 00:00:00 作者:
可以對(duì)javascript的大小進(jìn)行壓縮。使javascript的加載速度變快。
作用:可以對(duì)javascript的大小進(jìn)行壓縮。使javascript的加載速度變快。
用法:
在 cmd下面輸入的東西;
cscript ESC.wsf -l 3 -ow ../global.js global.js
上面是一個(gè)簡(jiǎn)單的例子:可以自己建一個(gè)bat文件放在當(dāng)前目錄下面
cscript ESC.wsf -l 壓縮級(jí)別 -ow 。。/要壓縮到那個(gè)目錄 需要進(jìn)行壓縮的原js
1.
Level 0 :: No compression //沒(méi)有處里
Level 1 :: Comment removal //刪除掉注釋
Level 3 :: Newline removal //刪除掉新行
Level 4 :: Variable substitution //變量的替換
2.下圖時(shí)所用到的參數(shù):
-l 級(jí)別
-s
-v
-$
-oa 以追加的形式覆蓋
-ow 以覆蓋的形式覆蓋
所用壓縮包在附件 還有幫助文檔
使用的例子見(jiàn)壓縮包中的圖片。
下載地址 http://xiazai.jb51.net/201003/yuanma/ESC.rar
Introduction
ESC is an ECMAScript pre-processor written in JScript, enabling an unlimited number of external scripts to be compressed/crunched into supertight, bandwidth-optimized packages. Featuring several compression-techniques such as comment removal, whitespace stripping, newline stripping and variable substitution ESC can reduce the overall size of your code with up to ~45%. Single, multiple scripts and even directories with scripts can be merged together at the compression level you decide. The processed output can later be appended or written to a file, or piped to another application for further processing via STDOUT. ESC do NOT support crunching of inline scripts. So any attempt passing HTML, ASP, JSP, PHP or other equivalent documents to ESC is done at your own risk. ESC supports four levels of compression, where a higher level equals higher compression. Beware though that levels >2 requires your code to be syntaxically perfect or ESC will punish you by producing a broken and useless output. The compression ratio should hit around 25% using the default compression level on a vanilla looking script, but results as high as ~45% can be achieved depending on the script's design / your style of writing code. ESC's compression engine is intelligent in the meaning that it has language syntax, statement and keyword awareness and it *knows* about native objects and members provided by the most common scripting hosts. This knowledgebase can easily be extended by pluggin in userdefined maps with additional information to further gain control of the crunching procedure. During processing following things are taken into account : String and RegExpression read-ahead
JScript Conditional compilation statements and variables
ECMA-262 Core language definitions (ECMAScript)
Intermediate DOM's (level 0) and DOM level 1
MS JScript specific objects/methods
Netscape/Mozilla/Opera specific objects/methods/properties
MS WSH (Windows Scripting Host) 1+ native objects
用法:
在 cmd下面輸入的東西;
cscript ESC.wsf -l 3 -ow ../global.js global.js
上面是一個(gè)簡(jiǎn)單的例子:可以自己建一個(gè)bat文件放在當(dāng)前目錄下面
cscript ESC.wsf -l 壓縮級(jí)別 -ow 。。/要壓縮到那個(gè)目錄 需要進(jìn)行壓縮的原js
1.
Level 0 :: No compression //沒(méi)有處里
Level 1 :: Comment removal //刪除掉注釋
Level 3 :: Newline removal //刪除掉新行
Level 4 :: Variable substitution //變量的替換
2.下圖時(shí)所用到的參數(shù):
-l 級(jí)別
-s
-v
-$
-oa 以追加的形式覆蓋
-ow 以覆蓋的形式覆蓋
所用壓縮包在附件 還有幫助文檔
使用的例子見(jiàn)壓縮包中的圖片。
下載地址 http://xiazai.jb51.net/201003/yuanma/ESC.rar
Introduction
ESC is an ECMAScript pre-processor written in JScript, enabling an unlimited number of external scripts to be compressed/crunched into supertight, bandwidth-optimized packages. Featuring several compression-techniques such as comment removal, whitespace stripping, newline stripping and variable substitution ESC can reduce the overall size of your code with up to ~45%. Single, multiple scripts and even directories with scripts can be merged together at the compression level you decide. The processed output can later be appended or written to a file, or piped to another application for further processing via STDOUT. ESC do NOT support crunching of inline scripts. So any attempt passing HTML, ASP, JSP, PHP or other equivalent documents to ESC is done at your own risk. ESC supports four levels of compression, where a higher level equals higher compression. Beware though that levels >2 requires your code to be syntaxically perfect or ESC will punish you by producing a broken and useless output. The compression ratio should hit around 25% using the default compression level on a vanilla looking script, but results as high as ~45% can be achieved depending on the script's design / your style of writing code. ESC's compression engine is intelligent in the meaning that it has language syntax, statement and keyword awareness and it *knows* about native objects and members provided by the most common scripting hosts. This knowledgebase can easily be extended by pluggin in userdefined maps with additional information to further gain control of the crunching procedure. During processing following things are taken into account : String and RegExpression read-ahead
JScript Conditional compilation statements and variables
ECMA-262 Core language definitions (ECMAScript)
Intermediate DOM's (level 0) and DOM level 1
MS JScript specific objects/methods
Netscape/Mozilla/Opera specific objects/methods/properties
MS WSH (Windows Scripting Host) 1+ native objects
相關(guān)文章
form表單數(shù)據(jù)封裝成json格式并提交給服務(wù)器的實(shí)現(xiàn)方法
下面小編就為大家分享一篇form表單數(shù)據(jù)封裝成json格式并提交給服務(wù)器的實(shí)現(xiàn)方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2017-12-12JS實(shí)現(xiàn)屏蔽網(wǎng)頁(yè)右鍵復(fù)制及ctrl+c復(fù)制的方法【2種方法】
這篇文章主要介紹了JS實(shí)現(xiàn)屏蔽網(wǎng)頁(yè)右鍵復(fù)制及ctrl+c復(fù)制的方法,結(jié)合實(shí)例形式分析了2種比較常用的屏蔽復(fù)制功能的技巧,需要的朋友可以參考下2016-09-09js中Function引用類(lèi)型常見(jiàn)有用的方法和屬性詳解
在本篇文章里小編給大家整理的是關(guān)于js中Function引用類(lèi)型常見(jiàn)有用的方法和屬性知識(shí)點(diǎn),有興趣的朋友們可以學(xué)習(xí)下。2019-12-12