YUI Compressor

The YUI Compressor is another tool similar to Dojo ShrinkSafe, that we can use to minify JavaScript. It can also be used to minify CSS files.


If you want to use YUI COmpressor first you should download it from here. Then you use it using command line tool.



  • You can use following syntax to compress test.js into test.min.js

    java -jar yuicompressor-***.jar -o test.min.js test.js

    It seems that YUI Compressor does nto support combining multiple files into one, instead you will have to use either cat command on linux or copy command on windows to combine multiple files into one and then use YUICompressor to minify the resultant file

  • You can use the YUI COmpressor to compress the CSS files too, it depends on the file extension to figure out if its .js or .css file and takes care to minify it accordingly

    java -jar yuicompressor-***.jar -o test.min.css test.css


    But if you want you can also specify the the --type command to specify the type of file you want to compress, so the syntax for compressing CSS file would be like this

    java -jar yuicompressor-***.jar --type css -o test.min.css test.css




Take a look at YUI compressor help page for details on the command line option

3 comments:

srjwebsolutions said...

We are leading responsive website designing and development company in Noida.
We are offering mobile friendly responsive website designing, website development, e-commerce website, seo service and sem services in Noida.

Responsive Website Designing Company in Noida
Website Designing Company in Noida
SEO Services in Noida
SMO Services in Noida

Vikas Chaudhary said...

Battery Mantra is Authorized exide car battery dealer in Noida and Greater Noida. We are providing our service in Indirapuram, Delhi, Ashok Nagar.

Exide Battery Dealer in Noida
Battery Dealer in Noida
Authorized Battery Dealer in Noida
Car Battery Dealer in Noida
Car Battery Dealer
Exide Battery Dealer

EG MEDI said...

Egmedi.com is online medical store pharmacy in laxmi nagar Delhi. You can Order prescription/OTC medicines online.
Cash on Delivery available. Free Home Delivery


Online Pharmacy in Delhi
Buy Online medicine in Delhi
Online Pharmacy in laxmi nagar
Buy Online medicine in laxmi nagar
Onine Medical Store in Delhi
Online Medical store in laxmi nagar
Online medicine store in delhi
online medicine store in laxmi nagar
Purchase Medicine Online
Online Pharmacy India
Online Medical Store