Tuesday, 22 July 2014

Compress the JS/CSS files using yui-compressor in Ubuntu


Hi,
   In this post i am showing how to compress the js as well as css file using yui-compressor.

Step 1: Install the YUI-COMPRESSOR.
         
 You can install the yui-compressor using a simple command

$ sudo apt-get install yui-compressor

or

You can directly install from the Ubuntu Software center by searching by yui-compressor 

Step 2: 
You can minify the CSS files by using the following command

 $ yui-compressor --type css -o main-min.css main.css

If you have to minify more files use the following command

$ yui-compressor --type css -o main-min.css file1.css file2.css


Similarly you can minify the JS files as follows

$ yui-compressor --type js -o main-min.js main.js


If you want know more about the Yui-compressor try the following command
$ yui-compressor -help



No comments:

Post a Comment