cialis online pharmacy generic xenical cheap cialis online cialis generic viagra online in canada buy cheap levitra online cialis without a perscription order viagra uk no prescription flagyl cheap generic levitra buying viagra in the uk cheap viagra approved cialis deltasone online buy viagra online without prescription non prescription cialis buy orlistat uk buy cialis in india prednisone 60 mg female viagra online buy viagra without prescription celebrex prescriptions buy cialis canada best prices viagra alternative to prednisone cheapest generic levitra levitra 5mg cheap viagra cialis on line buy xenical without prescription online accutane canadian health care prednisone no prescreption viagra online generic female viagra europe buy cialis low price cheap india viagra

Clean-css – A Node.js CSS Compressor

Today’s feature is GoalSmashers’ node.js library called clean-css. It’s a nice and very simple utility for minifying and concatenating CSS files. It strips unnecessary whitespace, removes comments, deletes the last semicolon of every selector, and more. Basically, it does the same job as YUI Compressor’s CSS minifier but much faster.

Using the clean-css library is fairly easy (and again, simple).


npm install clean-css

Example usage (minifying a css file named ‘public.css’):

cleancss -o public-min.css public.css

To minify the same above file into standard output, skip the –o parameter:

cleancss public.css

Alternatively, you could do it this way:

cat one.css two.css three.css | cleancss -o merged-and-minified.css

Using clean-css via NodeJA apps (i.e. within your JavaScript code):

# Get the clean-css package
var cleanCSS = require('clean-css');
# Read in the source of a file or use hard-coded CSS...
var source = "body { color: red; font-weight: bold; }";
# Minify!
 var minifiedCSS = cleanCSS.process(source);

If you want to preserve a comment block:

Important comments included in minified output.

To run a clean-css test:

make test

For more info and details about this library, check out its GitHub page.


Related Posts

Adding Instagram Badges to Your WordPress Profile

How to Create a Custom WordPress Registration Form with Flat UI

How to Create A Basic Hipster-Style Layout

How to Style Nav Links Using Floats With HTML5 and CSS3