Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Commit b5ece99

Browse files
committed
Fixed: compress option now works again correctly (1.8.4)
Close #195 Close #194
1 parent 8710e43 commit b5ece99

9 files changed

+40
-27
lines changed

.editorconfig

-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,3 @@ indent_size = 2
1111

1212
[*.md]
1313
trim_trailing_whitespace = false
14-
15-
[Makefile]
16-
indent_style = tab

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# 1.8.4 - 2015-08-24
2+
3+
- Fixed: `compress` option now works again correctly. A recent update in cssnano
4+
has introduced some minor breaking changes the way cssnext changed plugins
5+
metadata (`pluginName`).
6+
A direct minor change is that `messages` (in console or in css output) now show
7+
real origin (postcss plugin name) instead of a vague "cssnext" origin.
8+
([#195](https://github.com/cssnext/cssnext/issues/195))
9+
110
# 1.8.3 - 2015-08-06
211

312
- Fixed: `url` option (postcss-url) have been updated in order to benefit from

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cssnext",
3-
"version": "1.8.3",
3+
"version": "1.8.4",
44
"description": "Use tomorrow's CSS syntax, today",
55
"keywords": [
66
"css",
@@ -35,7 +35,7 @@
3535
"chalk": "^1.0.0",
3636
"chokidar": "^1.0.0",
3737
"commander": "^2.3.0",
38-
"cssnano": "^2.0.1",
38+
"cssnano": "^2.6.1",
3939
"exit": "^0.1.2",
4040
"mkdirp": "^0.5.1",
4141
"pixrem": "^1.1.0",
@@ -80,8 +80,8 @@
8080
"cssrecipes-grid": "^0.4.0",
8181
"cssrecipes-utils": "^0.5.0",
8282
"cssrecipes-vertical-rhythm": "^0.6.0",
83-
"eslint": "^1.0.0-rc-1",
84-
"eslint-loader": "^0.14.2",
83+
"eslint": "^1.0.0",
84+
"eslint-loader": "^1.0.0",
8585
"eslint-plugin-react": "^3.0.0",
8686
"extract-text-webpack-plugin": "^0.8.0",
8787
"file-loader": "^0.8.3",

src/__tests__/fixtures/compress.css

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

22
/*! sha */
3-
/* blah */
43
body {
5-
color : red;
4+
color : black;
65
}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/*! sha */body{color:red}
1+
/*! sha */body{color:#000}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
body{color:red}
1+
/*! sha */body{color:black}

src/__tests__/option.compress.js

+19-4
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,34 @@ test("cssnext compress option", function(t) {
1414
options: utils.readFixture("compress.options.expected").trim(),
1515
}
1616

17-
// compress option
1817
t.equal(
19-
cssnext(input, {compress: true}).trim(),
18+
cssnext(
19+
input,
20+
{
21+
compress: true,
22+
}
23+
).trim(),
2024
expected.default,
2125
"should be able to compress"
2226
)
2327
t.equal(
24-
cssnext(input, {compress: {comments: {removeAll: true}}}).trim(),
28+
cssnext(
29+
input,
30+
{
31+
compress: {
32+
colormin: false,
33+
},
34+
}
35+
).trim(),
2536
expected.options,
2637
"should be able to compress with options"
2738
)
2839
t.equal(
29-
postcss().use(cssnext({compress: true})).process(input).css.trim(),
40+
postcss().use(
41+
cssnext({
42+
compress: true,
43+
})
44+
).process(input).css.trim(),
3045
expected.default,
3146
"should be able to compress even as a postcss plugin"
3247
)

src/index.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ function cssnext(string, options) {
8383
? {...options.import}
8484
: undefined
8585
)
86-
plugin.postcssPlugin = "cssnext"
8786
postcss.use(plugin)
8887
}
8988

@@ -94,7 +93,6 @@ function cssnext(string, options) {
9493
? {...options.url}
9594
: undefined
9695
)
97-
plugin.postcssPlugin = "cssnext"
9896
postcss.use(plugin)
9997
}
10098
}
@@ -129,7 +127,6 @@ function cssnext(string, options) {
129127
? {...features[key]}
130128
: undefined
131129
)
132-
plugin.postcssPlugin = "cssnext"
133130
postcss.use(plugin)
134131
}
135132
})
@@ -147,9 +144,8 @@ function cssnext(string, options) {
147144

148145
// minification
149146
if (options.compress) {
150-
const nano = require("cssnano")
151147
postcss.use(
152-
nano(
148+
require("cssnano")(
153149
typeof options.compress === "object"
154150
? options.compress
155151
: {}
@@ -162,7 +158,6 @@ function cssnext(string, options) {
162158
// (which make sense)
163159
if (options.messages) {
164160
optionMessages(options).forEach(plugin => {
165-
plugin.postcssPlugin = "cssnext"
166161
postcss.use(plugin)
167162
})
168163
}

webpack.config.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,10 @@ module.exports = {
4646
],
4747
},
4848

49-
plugins: (
50-
[
51-
new webpack.DefinePlugin(buildConfig),
52-
new ExtractTextPlugin("[name].css", {disable: !buildConfig.__PROD__}),
53-
]
54-
.concat(
49+
plugins: ([
50+
new webpack.DefinePlugin(buildConfig),
51+
new ExtractTextPlugin("[name].css", {disable: !buildConfig.__PROD__}),
52+
].concat(
5553
buildConfig.__PROD__
5654
? [
5755
new webpack.optimize.DedupePlugin(),

0 commit comments

Comments
 (0)