Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compressing multiple JavaScript files with YUIcompressor?

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?

like image 795
Vivian River Avatar asked Sep 22 '11 16:09

Vivian River


1 Answers

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
like image 95
antyrat Avatar answered Nov 16 '22 15:11

antyrat