ESC之ESC.wsf可以實(shí)現(xiàn)javascript的代碼壓縮附使用方法第1/5頁
更新時(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 //沒有處里
Level 1 :: Comment removal //刪除掉注釋
Level 3 :: Newline removal //刪除掉新行
Level 4 :: Variable substitution //變量的替換
2.下圖時(shí)所用到的參數(shù):
-l 級(jí)別
-s
-v
-$
-oa 以追加的形式覆蓋
-ow 以覆蓋的形式覆蓋
所用壓縮包在附件 還有幫助文檔
使用的例子見壓縮包中的圖片。
下載地址 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 //沒有處里
Level 1 :: Comment removal //刪除掉注釋
Level 3 :: Newline removal //刪除掉新行
Level 4 :: Variable substitution //變量的替換
2.下圖時(shí)所用到的參數(shù):
-l 級(jí)別
-s
-v
-$
-oa 以追加的形式覆蓋
-ow 以覆蓋的形式覆蓋
所用壓縮包在附件 還有幫助文檔
使用的例子見壓縮包中的圖片。
下載地址 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)文章
詳解微信小程序用定時(shí)器實(shí)現(xiàn)倒計(jì)時(shí)效果
這篇文章主要介紹了微信小程序用定時(shí)器實(shí)現(xiàn)倒計(jì)時(shí)效果,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-04-04
原生javascript實(shí)現(xiàn)解析XML文檔與字符串
這篇文章主要介紹了javascript解析XML文檔和XML字符串的方法和具體的代碼解析,有需要的小伙伴可以參考下。2016-03-03
javascript使用閉包模擬對(duì)象的私有屬性和方法
本文給大家簡(jiǎn)單介紹了在一個(gè)項(xiàng)目中涉及到的javascript使用閉包模擬對(duì)象的私有屬性和方法,這里記錄下來,分享給大家。2016-10-10
JavaScript實(shí)現(xiàn)九九乘法表的簡(jiǎn)單實(shí)例
下面小編就為大家?guī)硪黄狫avaScript實(shí)現(xiàn)九九乘法表的簡(jiǎn)單實(shí)例。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-06-06
基于Bootstrap的網(wǎng)頁設(shè)計(jì)實(shí)例
這篇文章主要介紹了基于Bootstrap的網(wǎng)頁設(shè)計(jì)實(shí)例,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2017-03-03
分享兩個(gè)手機(jī)訪問pc網(wǎng)站自動(dòng)跳轉(zhuǎn)手機(jī)端網(wǎng)站代碼
這篇文章主要介紹了分享兩個(gè)手機(jī)訪問pc網(wǎng)站自動(dòng)跳轉(zhuǎn)手機(jī)端網(wǎng)站代碼,需要的朋友可以參考下2015-01-01
PhantomJS快速入門教程(服務(wù)器端的 JavaScript API 的 WebKit)
Phantom JS是一個(gè)服務(wù)器端的 JavaScript API 的 WebKit。其支持各種Web標(biāo)準(zhǔn): DOM 處理, CSS 選擇器, JSON, Canvas, 和 SVG2015-08-08
javascript中checkbox使用方法實(shí)例演示
這篇文章通過簡(jiǎn)單的實(shí)例演示了javascript中checkbox使用方法,感興趣的小伙伴們可以參考一下2015-11-11

