使用YUIcompressor压缩多个JavaScript文件? [英] Compressing multiple JavaScript files with YUIcompressor?
问题描述
我尝试使用YUI Compressor压缩多个JS文件。
我认为我的语法错误。我想压缩以开头在_
目录中的所有文件。但是,当YUI Compressor运行时,我发现YUI Compressor只在输出中放置了一个文件的压缩版本。
具体来说,假设我有三个文件: at_1.js,at_2.js和at_3.js。
我想在at_min.js中的所有三个js文件的压缩输出
我使用以下语法:
java -jar c:\Tools\yuicompressor-2.4.2.jar --type js --charset utf-8 -oc:\temp\\ \\ at_min.js c:\temp\scripts\at_ *
当我打开at_min .js,我只找到at_1.js的压缩内容。
如果您使用的是Windows,可以使用 YUI Compressor for .Net 来做。
或在使用简单命令压缩之前组合文件:
/ b at_1.js + at_2.js + at_3.js at_combined.js
$ p¥p>
java -jar c:\Tools\yuicompressor-2.4.2.jar --type js --charset utf-8 -o at_min .js at_combined.js
I'm trying to compress multiple JS files using the YUI Compressor.
I think that I'm getting the syntax wrong. I want to compress all files in a directory that start with
at_
. However, when YUI Compressor runs, I find that YUI Compressor has placed only the compressed version of one file in the output.To be specific, suppose I have three files: at_1.js, at_2.js, and at_3.js. I would like the compressed output of all three js files in at_min.js
I'm using the following syntax:
java -jar c:\Tools\yuicompressor-2.4.2.jar --type js --charset utf-8 -o c:\temp\at_min.js c:\temp\scripts\at_*
When I open up at_min.js, I find only the compressed contents of at_1.js. What am I doing wrong?
解决方案If you are using Windows you can use YUI Compressor for .Net to do that.
Or combining files before compressing with a simple command:
copy /b at_1.js+at_2.js+at_3.js at_combined.js java -jar c:\Tools\yuicompressor-2.4.2.jar --type js --charset utf-8 -o at_min.js at_combined.js
这篇关于使用YUIcompressor压缩多个JavaScript文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!