mincss

Minify CSS with Source Map support

MinCSS

Minify CSS with Source Map support.

Forked from CSSWring. Written with PostCSS.

$ npm install mincss
var fs = require('fs');
var mincss = require('mincss');

var css = fs.readFileSync('styles.css', 'utf8');
fs.writeFileSync('styles.min.css', mincss.minify(css).css);

You can pass options as second parameter to mincss.minify(). To preserve "doc block" style comments (/*! ... */), set preserveComments option to true. Likewise, to preserve some CSS hacks, set preserveHacks option.

This modules also includes a command line interface.

$ mincss --help
Usage:
  mincss [options] [INPUT] [OUTPUT]

Description:
  Minify CSS with Source Map support.

Options:
      --sourcemap          Create source map file.
      --preserve-comments  Preserve "doc block" comments.
      --preserve-hacks     Preserve some CSS hacks.
  -h, --help               Show this message.
  -v, --version            Print version information.

MIT