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)

相关文章

  • JavaScript前补零操作实例

    JavaScript前补零操作实例

    这篇文章主要介绍了JavaScript前补零操作的方法,以实例形式对比分析了javascript实现补零操作的技巧,具有一定参考借鉴价值,需要的朋友可以参考下
    2015-03-03
  • JavaScript闭包详解

    JavaScript闭包详解

    这篇文章主要为大家介绍了JavaScript闭包,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,希望能够给你带来帮助
    2021-11-11
  • 基于JSON数据格式详解

    基于JSON数据格式详解

    下面小编就为大家带来一篇基于JSON数据格式详解。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
    2017-08-08
  • js数据类型转换与流程控制操作实例分析

    js数据类型转换与流程控制操作实例分析

    这篇文章主要介绍了js数据类型转换与流程控制操作,结合实例形式分析了JavaScript数据类型转换与流程控制相关原理、操作技巧与使用注意事项,需要的朋友可以参考下
    2019-12-12
  • 带你领略Object.assign()方法的操作方式

    带你领略Object.assign()方法的操作方式

    这篇文章主要介绍了带你领略Object.assign()方法的操作方式,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教
    2022-08-08
  • 原生js验证简洁注册登录页面

    原生js验证简洁注册登录页面

    这篇文章主要为大家详细介绍了原生js验证简洁美观注册登录页面的相关资料,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2016-12-12
  • js实现5秒倒计时重新发送短信功能

    js实现5秒倒计时重新发送短信功能

    这篇文章主要为大家详细介绍了js实现5秒倒计时重新发送短信功能,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2017-02-02
  • 微信小程序下拉加载和上拉刷新两种实现方法详解

    微信小程序下拉加载和上拉刷新两种实现方法详解

    这篇文章主要介绍了微信小程序下拉加载和上拉刷新两种实现方法详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
    2019-09-09
  • JavaScript实现五子棋小游戏

    JavaScript实现五子棋小游戏

    这篇文章主要为大家详细介绍了JavaScript实现五子棋小游戏,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2020-10-10
  • 使用JavaScript进行表单校验功能

    使用JavaScript进行表单校验功能

    最近在学习JavaScript,因此想到使用js实现表单校验。下面通过本文给大家分享使用javascript实现表单校验功能的步骤,需要的的朋友参考下吧
    2017-08-08

最新评论