Skip to content

Commit cef02d4

Browse files
committed
refactor: use postcss-preset-env
1 parent 4c2c49a commit cef02d4

3 files changed

Lines changed: 329 additions & 17 deletions

File tree

lib/clark-plugin.js

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@ module.exports = class ClarkPlugin extends Plugin {
2424
// Use :enter, which is equal to :hover and :focus combined
2525
require('postcss-pseudo-class-enter'),
2626

27-
// https://github.com/jonathantneal/postcss-pseudo-class-any-link
28-
// Combination of :link and :visited
29-
require('postcss-pseudo-class-any-link'),
30-
31-
// https://github.com/postcss/postcss-custom-selectorsx
32-
// @custom-selector :--heading h1, h2, h3;
33-
require('postcss-custom-selectors'),
34-
3527
// https://github.com/jedmao/postcss-nested-props
3628
// Nest properties like `font: { size: 10px; family: Helvetica; }`
3729
// @TODO: https://github.com/jedmao/postcss-nested-props/issues/9
@@ -83,9 +75,34 @@ module.exports = class ClarkPlugin extends Plugin {
8375
// cubic-bezier() for linear-gradient()
8476
require('postcss-easing-gradients'),
8577

86-
// https://github.com/postcss/autoprefixer
87-
// Add vendor prefixes to rules by Can I Use
88-
require('autoprefixer')({ browsers: this.browsers })
78+
// https://github.com/csstools/postcss-preset-env
79+
// Adds vendor prefixes based on Can I Use and polyfills new features
80+
require('postcss-preset-env')({
81+
browsers: this.browsers,
82+
83+
// https://cssdb.org/
84+
stage: 4,
85+
86+
// Disable `preserve` so that the resulting CSS is consistent among all
87+
// browsers, diminishing the probability of discovering bugs only when
88+
// testing in older browsers
89+
preserve: false,
90+
91+
// Enable features that we want, despite being proposals yet
92+
features: {
93+
'custom-selectors': true,
94+
'custom-properties': true,
95+
'custom-media-queries': true,
96+
'nesting-rules': true,
97+
'pseudo-class-any-link': true
98+
},
99+
100+
autoprefixer: {
101+
// We don't use prefixes unless they are really necessary, e.g. when
102+
// dealing with quirks therefore, we disable removing them.
103+
remove: false
104+
}
105+
})
89106
];
90107

91108
for (const [stage, plugins] of Object.entries({ before, after })) {

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@
1919
"start": "ember serve"
2020
},
2121
"dependencies": {
22-
"autoprefixer": "^9.4.10",
2322
"postcss-calc": "^7.0.1",
2423
"postcss-color-function": "^4.0.1",
2524
"postcss-conditionals": "^2.1.0",
26-
"postcss-custom-selectors": "^5.1.2",
2725
"postcss-each": "^0.10.0",
2826
"postcss-easing-gradients": "^3.0.1",
2927
"postcss-for": "^2.1.1",
@@ -32,8 +30,8 @@
3230
"postcss-nested": "^4.1.2",
3331
"postcss-nested-ancestors": "^2.0.0",
3432
"postcss-nested-props": "^2.0.0",
33+
"postcss-preset-env": "^6.6.0",
3534
"postcss-property-lookup": "^2.0.0",
36-
"postcss-pseudo-class-any-link": "^6.0.0",
3735
"postcss-pseudo-class-enter": "^5.0.0",
3836
"postcss-scss": "^2.0.0",
3937
"postcss-short": "^5.0.0"

0 commit comments

Comments
 (0)