diff --git a/CHANGELOG.md b/CHANGELOG.md index 950225b..f0c629f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.5.0 - 2015-05-23 + +- Added: `compress` option used cssnano instead of CSSWring. + # 1.4.0 - 2015-05-01 - Added: support for `:matches()` selector pseudo class diff --git a/README.md b/README.md index 34f77a8..04c86dc 100644 --- a/README.md +++ b/README.md @@ -306,8 +306,8 @@ _Note: you can pass [postcss-url options](https://github.com/postcss/postcss-url ##### `compress` (default: `false`) -Allows you to compress the output (using [CSSWring](https://github.com/hail2u/node-csswring)). -You can enable minification by passing `true` or by providing an object containing [CSSWring options](https://github.com/hail2u/node-csswring#options). +Allows you to compress the output (using [cssnano](https://github.com/ben-eb/cssnano)). +You can enable minification by passing `true` or by providing an object containing [cssnano options](https://github.com/ben-eb/cssnano#options). ##### `sourcemap` (default: `false`) diff --git a/index.js b/index.js index b5426c4..dd6d8a5 100644 --- a/index.js +++ b/index.js @@ -141,8 +141,17 @@ function cssnext(string, options) { // minification if (options.compress) { - var csswring = require("csswring") - postcssInstance.use(typeof options.compress === "object" ? csswring(options.compress) : csswring) + var nano = require("cssnano") + + /* forced calc options to false */ + if (typeof options.compress === "object") { + options.compress.calc = false + } + else { + options.compress = {calc: false} + } + + postcssInstance.use(nano(options.compress)) } // classic API if string is passed diff --git a/package.json b/package.json index e8e77c6..b592f04 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cssnext", - "version": "1.4.0", + "version": "1.5.0", "description": "Use tomorrow's CSS syntax, today", "keywords": [ "css", @@ -32,7 +32,7 @@ "chokidar": "^1.0.0", "colors": "^1.0.2", "commander": "^2.3.0", - "csswring": "^3.0.0", + "cssnano": "^1.2.0", "exit": "^0.1.2", "object-assign": "^2.0.0", "pixrem": "^1.1.0", diff --git a/test/cli.js b/test/cli.js index 7ff6c92..3189c9e 100644 --- a/test/cli.js +++ b/test/cli.js @@ -90,7 +90,7 @@ test("cli", function(t) { exec(cssnextBin + " --compress test/fixtures/compress.css", function(err, stdout) { if (err) { throw err } - t.equal(stdout, utils.readFixture("compress.default.expected").trim(), "should compress on --compress") + t.equal(stdout.trim(), utils.readFixture("compress.default.expected").trim(), "should compress on --compress") }) planned += 1 diff --git a/test/option.compress.js b/test/option.compress.js index a342d8d..cd15d8e 100644 --- a/test/option.compress.js +++ b/test/option.compress.js @@ -16,7 +16,7 @@ test("cssnext compress option", function(t) { // compress option t.equal(cssnext(input, {compress: true}).trim(), expected.default, "should be able to compress") - t.equal(cssnext(input, {compress: {removeAllComments: true}}).trim(), expected.options, "should be able to compress with options") + t.equal(cssnext(input, {compress: {comments: {removeAll: true}}}).trim(), expected.options, "should be able to compress with options") t.equal(postcss().use(cssnext({compress: true})).process(input).css.trim(), expected.default, "should be able to compress even as a postcss plugin") t.end()