ESC之ESC.wsf可以实现javascript的代码压缩附使用方法第3/5页

 更新时间:2007年05月07日 00:00:00   作者:  
可以对javascript的大小进行压缩。使javascript的加载速度变快。

Commandline options
There are a set of options available to provide full control of how you want your source files treated. This list is also available by running ESC with the -help option, but I'll try to explain some of them here more indepth.
 
  • -l (level) Sets the crunch-level you wish to use in the range of 0-4. If this option is not set, level 2 is assumed.
  • -s (silent) Produce no report and no error messages whatsoever.
  • -v (verbose) When verbose mode is enabled, ESC will echo every action performed back to the console. This comes in handy when debugging or if you just want to view the process taking place. By using > you can even pipe the verbosed output to a logfile or similar. Ex. cscript ESC.wsf -v -ow all.js C:\script-dir > verbose.log
  • -$ This option explicitly instructs ESC to activate the variable-substitution engine. The substition engine is the man doing the dirtywork at level 4, responsible for the most complex part of the crunching process, but by using this option ESC can be told to use it on lower levels also. For instance, using the option-combo -l 0 -$ would leave your scripts unprocessed in terms of whitespace and comments, but any variable-name not recognized as blessed will be mangled within a global scope.
  • -oa <filename> With this directive you are telling ESC to append the crunched data to the file specified. If the specified file doesn't exist, ESC will create it.
  • -ow <filename> | STDOUT Same as with -ao, but with the difference that ESC will write the output to the file specified instead of appending. This option will cause any previous file with the same name to be overwritten, so be careful. Optionally you can instruct ESC to write the stream to STDOUT instead of a file. Comes in handy if you are piping the output to another process.
 

 -----------------------------------------------------------
 Usage :
 ESC.wsf -l [0-4] -ow output.js foo.js bar.js C:\scripts\baz
 -----------------------------------------------------------
 -a  [-about]             : Description page
 -c  [-copyright]         : Copyright/license notice
 -e  [-example]           : Examples of usage
 -h  [-help]              : This help-screen
 -----------------------------------------------------------
 -l  [-level]   [01(2)34] : [optional] Set crunch-level (4 sets -$ on)
 -s  [-silent]            : [optional] Run silent, nada stdout
 -v  [-verbose]           : [optional] Run in verbose mode
 -$                       : [optional] Activate variable-substitution engine
 -----------------------------------------------------------
 -oa <filename>           : Target filename for appending
 -ow <filename>           : Target filename for writing
 -ow STDOUT               : Write stream to STDOUT
 -----------------------------------------------------------
 <input-file(s)>           : [required]
 file(s) and/or directories containing scripts to crunch...
 (If filenames contains spaces, they must be quoted)

相关文章

最新评论