Skip to content

Commit cd90fc3

Browse files
committed
Merge PR animate-css#1907: fix: migrate PostCSS config to v8 plugin API and update dependencies (conflicts resolved: prefer PR changes)
2 parents f859341 + 397bfab commit cd90fc3

File tree

3 files changed

+1338
-1882
lines changed

3 files changed

+1338
-1882
lines changed

package.json

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@
4444
"devDependencies": {
4545
"autoprefixer": "^10.4.7",
4646
"cssnano": "^5.0.17",
47-
"eslint": "^4.1.1",
47+
"eslint": "^7.32.0",
4848
"husky": "^7.0.4",
4949
"lint-staged": "^11.2.6",
5050
"markdown-it": "^12.3.2",
5151
"npm-run-all": "^4.1.5",
52-
"postcss": "^8.4.14",
53-
"postcss-cli": "^8.3.1",
54-
"postcss-header": "^3.0.1",
55-
"postcss-import": "^14.0.2",
52+
"postcss": "^8.5.6",
53+
"postcss-cli": "^11.0.1",
54+
"postcss-header": "^3.0.3",
55+
"postcss-import": "^16.1.0",
5656
"postcss-prefixer": "^3.0.0",
57-
"postcss-preset-env": "^11.1.3",
57+
"postcss-preset-env": "^9.6.0",
5858
"prettier": "^2.7.1"
5959
},
6060
"lint-staged": {
@@ -65,8 +65,5 @@
6565
"animate.min.css",
6666
"animate.css",
6767
"source/**/*.css"
68-
],
69-
"dependencies": {
70-
"animate.css": "^4.1.1"
71-
}
68+
]
7269
}

postcss.config.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
const fs = require('fs');
2+
const postcssImport = require('postcss-import');
3+
const postcssPrefixer = require('postcss-prefixer');
4+
const postcssPresetEnv = require('postcss-preset-env');
5+
const autoprefixer = require('autoprefixer');
6+
const cssnano = require('cssnano');
7+
const postcssHeader = require('postcss-header');
8+
29
const {homepage, version, author, animateConfig} = JSON.parse(fs.readFileSync('package.json'));
310

411
const header = `
@@ -23,24 +30,22 @@ module.exports = (ctx) => {
2330
return {
2431
map: ctx.options.map,
2532
parser: ctx.options.parser,
26-
plugins: {
27-
'postcss-import': {root: ctx.file.dirname},
28-
'postcss-prefixer': {
33+
plugins: [
34+
postcssImport({root: ctx.file.dirname}),
35+
postcssPrefixer({
2936
prefix,
3037
ignore: [/\[class\*=.*\]/],
31-
},
32-
'postcss-preset-env': {
33-
autoprefixer: {
34-
cascade: false,
35-
},
38+
}),
39+
postcssPresetEnv({
3640
features: {
3741
'custom-properties': true,
3842
},
39-
},
40-
cssnano: ctx.env === 'production' || ctx.env === 'compat' ? {} : false,
41-
'postcss-header': {
42-
header,
43-
},
44-
},
43+
}),
44+
autoprefixer({
45+
cascade: false,
46+
}),
47+
ctx.env === 'production' || ctx.env === 'compat' ? cssnano() : false,
48+
postcssHeader({header}),
49+
].filter(Boolean),
4550
};
4651
};

0 commit comments

Comments
 (0)