Skip to content
This repository was archived by the owner on Jun 13, 2021. It is now read-only.

Commit ca9d4ff

Browse files
authored
Plugins enabled via features should override browserslist (csstools#165)
1 parent fbb3b3d commit ca9d4ff

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

.tape.js

+9
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ module.exports = {
6565
}
6666
}
6767
},
68+
'custom-properties:enabled': {
69+
message: 'supports { browsers: "chrome >= 60", features: { "custom-properties": true } } usage',
70+
options: {
71+
browsers: 'chrome >= 60',
72+
features: {
73+
'custom-properties': true
74+
}
75+
}
76+
},
6877
'insert:before': {
6978
message: 'supports { stage: 1, features: { "color-mod-function": true }, insertBefore: { "color-mod-function": [ require("postcss-simple-vars") ] } } usage',
7079
options: {

src/postcss.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ export default postcss.plugin('postcss-preset-env', opts => {
8888

8989
// features supported by the stage and browsers
9090
const supportedFeatures = stagedFeatures.filter(
91-
feature => supportedBrowsers.some(
91+
feature => feature.id in features
92+
? features[feature.id]
93+
: supportedBrowsers.some(
9294
supportedBrowser => browserslist(feature.browsers, {
9395
ignoreUnknownVersions: true
9496
}).some(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
:root {
2+
--black: black;
3+
}
4+
5+
test-css-variables {
6+
color: black;
7+
color: var(--black);
8+
}

0 commit comments

Comments
 (0)