ESC Esc.wsf can implement code compression for JavaScript use method 1th/5 page _javascript Tips

Source: Internet
Author: User
Function: The size of JavaScript can be compressed. Make JavaScript faster to load.

Usage:
Something that is entered under CMD;
cscript esc.wsf-l 3-ow. /global.js Global.js

The above is a simple example: you can build a bat file under the current directory

cscript esc.wsf-l compression level-ow. /To compress the original JS to the directory that needs to be compressed
1.
Level 0:: No compression//No Place
Level 1:: Comment removal//Delete Comment
Level 3:: NewLine removal//Delete new line
Level 4:: Variable substitution//variable substitution
2. The parameters used in the following illustration:
-L Level
-S
-V
-$
The-oa is overwritten in the form of an append
-ow covered in the form of an overlay


The compressed package used in the attachment also has a help document

Use the example below to see the picture in the compressed package.

Download Address 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
Current 1/5 page 12345 Next read the full text
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.