LogoopenSUSE Build Service > Projects
Sign Up | Log In

Port of YUI CSS Compressor to NodeJ

UglifyCSS is a port of YUI Compressor to NodeJS for its CSS part. Its name is a reference to the awesome UglifyJS but UglifyCSS is not a CSS parser. Like YUI CSS Compressor, it applies many regexp replacements. Note that a port to JavaScript is also available in the YUI Compressor repository.

UglifyCSS passes successfully the test suite of YUI compressor CSS.

Be sure to submit valid CSS to UglifyCSS or you could get weird results.


For a command line usage:
$ npm install uglifycss -g

For API usage:
$ npm install uglifycss

From Github:
$ git clone git://github.com/fmarcia/UglifyCSS.git

Command line

$ uglifycss [options] [filename] [...] > output


--max-line-len n adds a newline (approx.) every n characters; 0 means no newline and is the default value
--expand-vars expands variables; by default, @variables blocks are preserved and var(x) s are not expanded
--ugly-comments removes newlines within preserved comments; by default, newlines are preserved
--cute-comments preserves newlines within and around preserved comments

If no file name is specified, input is read from stdin.


2 functions are provided:

processString( content, options ) to process a given string
processFiles( [ filename1, ... ], options ) to process the concatenation of given files

Options are identical to the command line:
* <int> maxLineLen for --max-line-len n
* <bool> expandVars for --expand-vars
* <bool> uglyComments for --ugly-comments
* <bool> cuteComments for --cute-comments

Both functions return uglified css.


var uglifycss = require('uglifycss');

var uglified = uglifycss.processFiles(
    [ 'file1', 'file2' ],
    { maxLineLen: 500, expandVars: true }


See also test.js .


UglifyCSS is MIT licensed.

Source Files

Filename Size Changed Actions
uglifycss-0.0.20.tgz 726 KB Download File
uglifycss.changes 147 Bytes Download File
uglifycss.json 48 Bytes Download File
uglifycss.license 3 Bytes Download File
uglifycss.source 68 Bytes Download File
uglifycss.spec 2.01 KB Download File

Comments for home:illuusio:nodejs-bundle (0)

Login required, please login or signup in order to comment