最近项目需求,要压缩js,文件就学习了YUI Compressor。
下载:http://yuilibrary.com/downloads/#yuicompressor。 最新的是2.4.6。前提是要安装jdk,就不废话了。
下载下来后解压。找到 yuicompressor-2.4.6\build\yuicompressor-2.4.6.jar
这个就是要运行的jar.
打开cmd.输入(我要压缩的文件放到了e盘符根目录。)
C:\Documents and Settings\Administrator>java -jar E:\yuicompressor-2.4.6\yuicomp
ressor-2.4.6\build\yuicompressor-2.4.6.jar --preserve-semi -o E:\outputfile.js E:\inputfile.js
好了,在e盘目录下就生成了一个压缩好的文件。参数详见下面。
-----------------------------------------------------------------------------------------
Usage: java -jar yuicompressor-x.y.z.jar [options] [input file]
Global Options
-h, --help Displays this information
--type <js|css> Specifies the type of the input file
--charset <charset> Read the input file using <charset>
--line-break <column> Insert a line break after the specified column numbr
-v, --verbose Display informational messages and warnings
-o <file> Place the output into <file>. Defaults to stdout.
Multiple files can be processed using the following
syntax:
java -jar yuicompressor.jar -o '.css$:-min.css' *.c
s
java -jar yuicompressor.jar -o '.js$:-min.js' *.js
JavaScript Options
--nomunge Minify only, do not obfuscate
--preserve-semi Preserve all semicolons
--disable-optimizations Disable all micro optimizations
If no input file is specified, it defaults to stdin. In this case, the 'type'
option is required. Otherwise, the 'type' option is required only if the input
file extension is neither 'js' nor 'css'.
------------------------------------------------------------------------------------------
语法: java -jar yuicompressor-x.y.z.jar [options] [input file]
通用参数:
-h, --help 显示帮助信息
--type <js|css> 指定输入文件的文件类型
--charset <charset> 指定读取输入文件使用的编码
--line-break <column> 在指定的列后插入一个 line-bread 符
号
-v, --verbose 显示info和warn级别的信息
-o <file> 指定输出文件。默认输出是控制台。
JavaScript专用参数:
--nomunge 只压缩, 不对局部变量进行混淆。
--preserve-semi 保留所有的分号。
--disable-optimizations 禁止优化。
分享到:
相关推荐
yuicompressor-2.4.2.jar yuicompressor-2.4.7.jar jsZip.exe yuicompressor yui compressor js压缩工具 javascript压缩工具 css压缩工具 ------------------------------------ //压缩JS java -jar yui...
yuicompressor.jar是JS压缩工具、前端优化神器、yuicompressor-2.4.8.jar
软件开发网提供的js,css压缩工具 yuicompressor 2.46打包简介 官方网址:http://developer.yahoo.com/yui/compressor/ JS与css 压缩工具 yui...yuicompressor使用纯Java编写,运行需要JDK1.4或更高版本,基于
可惜官网提供的版本都不具备右键功能,每次压缩都要cmd输入一些命令实在是繁琐,本文就介绍如何给YUI Compressor添加右键命令,方便使用。 网上已有一些网友写好的安装包,但对应的版本太低,目前最新最多人使用的...
javascript压缩工具YUI compressor,可以提供更好的压缩效率;该工具由著名的Yahoo Exceptional Performance项目组出品;YUI compressor的压缩效果比较...也可以去这里下:http://yuilibrary.com/download/yuicompressor/
IDEA(pycharm,phpstorm)添加外部插件-yuicompressor压缩js/css
js、css 压缩工具jar
压缩js文件,可安装,简单方便,安装后,右键js文件,选择process whit YUICompressor
YUI Compressor 是一个用来压缩 JS 和 CSS 文件的工具,采用Java开发。 使用方法: //压缩JS java -jar yuicompressor-...java -jar yuicompressor-2.4.2.jar --type css --charset utf-8 -v src.css > packed.css
如果用 Ant 执行 YUI Compressor 任务时出现了中文乱码,请下载此资源,用这里边 dist 目录里边的 YUIAnt-zh_CN.jar 替换掉官方提供的 YUIAnt.jar ,然后在对应的 Ant 任务中,用 encoding="xxx" 指定源文件的字符...
yuicompressor压缩js,css
压缩JS所使用jar包!...压缩JS:java -jar yuicompressor-2.4.jar --type js xxx.js -o xxx.js --charset utf-8 压缩CSS:java -jar yuicompressor-2.4.jar --type css xxx.css -o xxx.css --charset utf-8
yui compressor, js压缩工具, 可以有效减少js体积
基于java的开发源码-JSCSS压缩工具 YUI Compressor.zip 基于java的开发源码-JSCSS压缩工具 YUI Compressor.zip 基于java的开发源码-JSCSS压缩工具 YUI Compressor.zip 基于java的开发源码-JSCSS压缩工具 YUI ...
yuicompressor,玉伯,yui,js压缩,cs压缩
yuicompressor.jar js/css压缩 //压缩JS java -jar yuicompressor-2.4.2.jar --type js --charset utf-8 -v src.js > packed.js //压缩CSS java -jar yuicompressor-2.4.2.jar --type css --charset utf-8 -v src...
yuicompressor-maven-plugin, 用于压缩 (Minify/Ofuscate/Aggregate) Javascript文件和使用 YUI 压缩器的CSS文件的Maven 插件 [[Flattr this git repo] ( http://api.flattr.com/button/flattr-badge-large.png)]...