ESC之ESC.wsf可以實現(xiàn)javascript的代碼壓縮附使用方法第2/5頁
更新時間:2007年05月07日 00:00:00 作者:
可以對javascript的大小進行壓縮。使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)文章
form表單數(shù)據(jù)封裝成json格式并提交給服務(wù)器的實現(xiàn)方法
下面小編就為大家分享一篇form表單數(shù)據(jù)封裝成json格式并提交給服務(wù)器的實現(xiàn)方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2017-12-12JS實現(xiàn)屏蔽網(wǎng)頁右鍵復(fù)制及ctrl+c復(fù)制的方法【2種方法】
這篇文章主要介紹了JS實現(xiàn)屏蔽網(wǎng)頁右鍵復(fù)制及ctrl+c復(fù)制的方法,結(jié)合實例形式分析了2種比較常用的屏蔽復(fù)制功能的技巧,需要的朋友可以參考下2016-09-09