ESC之ESC.wsf可以實(shí)現(xiàn)javascript的代碼壓縮附使用方法第2/5頁(yè)
更新時(shí)間:2007年05月07日 00:00:00 作者:
可以對(duì)javascript的大小進(jìn)行壓縮。使javascript的加載速度變快。
Crunching, level by level
Level 0 :: No compression
No compression done. Basically a content transfer/append from input(s) to output. This level is mainly used for tracking down problems occuring to scripts after been shoved through the variable substitution engine.
Level 1 :: Comment removal
ESC removes empty lines (\r?\n)+, single and multi-line and single-line comments (//..., /* ... */) and trailing whitespace. [ \t]+\r?\n
Level 2 :: Whitespace removal
Any occurance of space and tabs (\s\t\r) are removed from the infile(s). This is the default compression-level if none is supplied.
Level 3 :: Newline removal
Newlines (\r?\n) are removed. ESC do not like sloppy written code and will at this level punish you for it by producing a very tight, human unreadable, uninpretable chunk o' chars :) So remember, *ALWAYS* terminate your statements with semi-colons (';'). If you come from a C/C++ bg you have probably been taught this the hard way by an evercroaking compiler. If not for getting your script thru ESC, so start doing it anyway for good ol' programming style.
Level 4 :: Variable substitution
(variable substitution mode, identical to options '-l 3 -$') Additionally to level 3, ESC will run your script(s) through the variable substitution engine. This will certainly break your scripts at the first try, but with a little fiddling around and once you understand how the substitution scheme works, this thing rule since it will save you another extra 5-20% bytewise depending on your coding style. Variable-names less than 3 chars are not affected. Before you try running ESC with variable substitution enabled, I advice you to carefully read the other sections in this manual about the pros and cons, thinking session-dependencies and the known caveats of variable crunching with ESC. Your specific situation in terms of namespaces, shared variables or the design/architecture of your scripts may make it difficult, even impossible to combine with this technique whereas you'll have to stick with level 3.
相關(guān)文章
詳解微信小程序用定時(shí)器實(shí)現(xiàn)倒計(jì)時(shí)效果
這篇文章主要介紹了微信小程序用定時(shí)器實(shí)現(xiàn)倒計(jì)時(shí)效果,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(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ì)象的私有屬性和方法,這里記錄下來(lái),分享給大家。2016-10-10
JavaScript實(shí)現(xiàn)九九乘法表的簡(jiǎn)單實(shí)例
下面小編就為大家?guī)?lái)一篇JavaScript實(shí)現(xiàn)九九乘法表的簡(jiǎn)單實(shí)例。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-06-06
基于Bootstrap的網(wǎng)頁(yè)設(shè)計(jì)實(shí)例
這篇文章主要介紹了基于Bootstrap的網(wǎng)頁(yè)設(shè)計(jì)實(shí)例,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2017-03-03
分享兩個(gè)手機(jī)訪問(wèn)pc網(wǎng)站自動(dòng)跳轉(zhuǎn)手機(jī)端網(wǎng)站代碼
這篇文章主要介紹了分享兩個(gè)手機(jī)訪問(wèn)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í)例演示
這篇文章通過(guò)簡(jiǎn)單的實(shí)例演示了javascript中checkbox使用方法,感興趣的小伙伴們可以參考一下2015-11-11

