If so, what is the usage? I am trying this:
-jar yuicompressor-2.4.7 file1.js, file2.js -o combined.js
but I get an error that the 'type' option should be specified.
If I do the same with 1 file, it is minified and the contents are output to stdout
. I would like to combine file1
and file2
in that order.
If it complains that the type option should be specified, you should specify it, like this:
-jar yuicompressor-2.4.7 file1.js, file2.js --type js -o combined.js
I don't think the YUI Compressor combines files. You can use Ant to automate the task of minifying and combining. If you're new to Ant and making build processes, this should be a good introduction: http://addyosmani.com/blog/client-side-build-process/
I know this question is old, but I just ran into this problem (or something similar). I believe the answer is that the @Nick's command syntax is incorrect for specifying multiple files. I think YUI Compessor does support processing multiple files but it only has one input file parameter, so you must use wildcards. IOW, this works:
...yui-compressor.jar -o blah.css *.css
This doesn't:
...yui-compressor.jar -o blah.css 1.css 2.css
At least this is my experience. One should be able to concatenate all the files together some other way and pipe them into the command though. For example, on Windows:
type 1.css 2.css | java -jar yui-compressor.jar --type js -o blah.css
Or on Unix/Linux:
cat 1.css 2.css | java -jar yui-compressor.jar --type js -o blah.css
(or you could probably use file redirection)
Make sure you cat
or type
the files in the desired order.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With