Package Exports
- uglifycss
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (uglifycss) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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.
Installation
For a command line usage:
$ npm install uglifycss -gFor API usage:
$ npm install uglifycssFrom Github:
$ git clone git://github.com/fmarcia/UglifyCSS.gitCommand line
$ uglifycss [options] [filename] [...] > outputOptions:
--max-line-len nadds a newline (approx.) everyncharacters;0means no newline and is the default value--expand-varsexpands variables; by default,@variablesblocks are preserved andvar(x)s are not expanded--ugly-commentsremoves newlines within preserved comments; by default, newlines are preserved--cute-commentspreserves newlines within and around preserved comments
If no file name is specified, input is read from stdin.
API
2 functions are provided:
processString( content, options )to process a given stringprocessFiles( [ filename1, ... ], options )to process the concatenation of given files
Options are identical to the command line:
<int> maxLineLenfor--max-line-len n<bool> expandVarsfor--expand-vars<bool> uglyCommentsfor--ugly-comments<bool> cuteCommentsfor--cute-comments
Both functions return uglified css.
Example
var uglifycss = require('uglifycss');
var uglified = uglifycss.processFiles(
[ 'file1', 'file2' ],
{ maxLineLen: 500, expandVars: true }
);
console.log(uglified);See also test.js.
License
UglifyCSS is MIT licensed.