Skip to content

Commit f690d6a

Browse files
authored
Feature/postcss 8 (#53)
* fix: test failed by mismatch normalize.css & sanitize.css * feat: upgrade to PostCSS@8
1 parent fd294fd commit f690d6a

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

package.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,27 @@
2525
"node": ">=10.0.0"
2626
},
2727
"dependencies": {
28-
"@csstools/normalize.css": "*",
29-
"postcss": "^7.0.27",
28+
"@csstools/normalize.css": "10.1.0",
3029
"postcss-browser-comments": "^3.0.0",
31-
"sanitize.css": "*"
30+
"sanitize.css": "11.0.0"
3231
},
3332
"devDependencies": {
3433
"@babel/core": "^7.9.0",
3534
"@babel/plugin-syntax-import-meta": "^7.8.3",
3635
"@babel/preset-env": "^7.9.5",
3736
"babel-eslint": "^10.1.0",
37+
"browserslist": "^4.16.3",
3838
"eslint": "^6.8.0",
39+
"postcss": "^8.2.8",
3940
"postcss-import": "^12.0.1",
40-
"postcss-tape": "^5.0.2",
41+
"postcss-tape": "^6.0.1",
4142
"pre-commit": "^1.2.2",
4243
"rollup": "^2.6.0",
4344
"rollup-plugin-babel": "^4.4.0"
4445
},
4546
"peerDependencies": {
46-
"browserslist": "^4"
47+
"browserslist": "^4.16.3",
48+
"postcss": "^8.2.8"
4749
},
4850
"babel": {
4951
"plugins": [

src/index.js

+15-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
1-
import { assign, create } from './lib/util';
2-
import postcss from 'postcss';
1+
import { create } from './lib/util';
32
import postcssBrowserComments from 'postcss-browser-comments';
43
import postcssImportNormalize from './lib/postcssImportNormalize';
54
import postcssNormalize from './lib/postcssNormalize';
65

7-
export default postcss.plugin('postcss-normalize', opts => {
6+
const plugin = opts => {
87
opts = create(opts);
98

10-
const commentsTransformer = postcssBrowserComments(opts);
9+
const commentsTransformer = postcssBrowserComments(opts).Once;
1110
const normalizeTransformer = postcssNormalize(commentsTransformer, opts);
1211
const postcssImportConfig = postcssImportNormalize(commentsTransformer, opts);
1312

14-
return assign(normalizeTransformer, { postcssImport: postcssImportConfig });
15-
});
13+
return {
14+
postcssPlugin: 'postcss-normalize',
15+
Once(root) {
16+
return normalizeTransformer(root)
17+
},
18+
postcssImport: postcssImportConfig
19+
}
20+
}
21+
22+
plugin.postcss = true;
23+
24+
export default plugin;

0 commit comments

Comments
 (0)