YUI Compressor on Linux
and run the commands from within our static content directory:
In stead of doing a
find search and a
-o <file> states:
Place the output into <file>. Defaults to stdout.
Multiple files can be processed using the following syntax:
java -jar yuicompressor.jar -o '.css$:-min.css' *.css
java -jar yuicompressor.jar -o '.js$:-min.js' *.js
git clone git://github.com/mishoo/UglifyJS2.git cd UglifyJS2 npm link .Code language: PHP (php)
YUI Compressor on Mac OS X
Mac OS X users can use
brew to install YUI Compressor:
brew install yuicompressor
Are you looking for rock solid, eco-friendly, .NET hosting? Look no further! UmbHost offers powerful hosting services for websites and businesses of all sizes, and is powered by 100% renewable energy!
YUI Compressor on Windows
Java is required to run YUI Compressor on Windows (as it is on Linux and Mac OS X too). Download and install Java first.
- Download and unzip YUI Compressor
cmd.exe, use the following command to execute YUI Compressor:
java -jar yuicompressor-2.4.7.jar style.css -o style-min.cssCode language: PowerShell (powershell)
The yuicompressor-2.4.7.jar file is located in the
Let’s dive more into YUI Compressor on Windows:
Suppose my website dev content is located in
E:\Data\Codebase\sites\saotn.org\www and I’ve placed YUI Compressor in
The following command compresses, or minifies, all CSS stylesheet files recursively, from within my content directory:
FOR /F %I in ('dir /b/s *.css') DO @java -jar C:\Temp\yuicompressor-2.4.7\build\yuicompressor-2.4.7.jar %I -o %ICode language: PowerShell (powershell)
FOR /F %I in ('dir /b/s *.js') DO @java -jar C:\Temp\yuicompressor-2.4.7\build\yuicompressor-2.4.7.jar %I -o %ICode language: PowerShell (powershell)
All you need to do afterwards is uploading your minified/compressed files to your website.