Skip to content

extend progressive-custom-properties to the var() function #979

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugin-packs/postcss-preset-env/dist/index.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plugin-packs/postcss-preset-env/dist/index.mjs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions plugin-packs/postcss-preset-env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
"postcss": "^8.4"
},
"devDependencies": {
"@csstools/postcss-debug-logger": "1.0.0",
"@csstools/postcss-tape": "*",
"@webref/css": "^6.5.1",
"postcss-simple-vars": "^7.0.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// ids ordered by required execution, then alphabetically
export default [
'custom-media-queries',
'custom-properties',
'environment-variables', // run environment-variables here to access transpiled custom media params and properties
'image-set-function', // run images-set-function before nesting-rules so that it may fix nested media
'media-query-ranges', // run media-query-range
Expand Down Expand Up @@ -56,5 +55,8 @@ export default [
'nested-calc',
// Math functions.

// must be after all value related rules
'custom-properties',

'cascade-layers',
];
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@
text-indent: 2em;
content: var(--value-2ic);
left: 2em;
left: var(--non-existing, 2ic);
left: var(--non-existing, 2em);
width: calc(8em + 20px);
height: 10px;
margin: 0.5em 1em .2em;
Expand Down Expand Up @@ -593,7 +593,7 @@

@supports (background: linear-gradient(in oklch, red 0%, red 0% 1%, red 2%)) and (color: hsl(0 0% 0% / 0)) {
.gradients-interpolation-method {
--background-image: linear-gradient(in oklch decreasing hue, hsl(0, 85%, 75%) 0%, hsl(180, 80%, 65%) 100%);
--background-image: linear-gradient(in oklch decreasing hue, hsl(0deg 85% 75%) 0%, hsl(180deg 80% 65%) 100%);
}
}

Expand All @@ -610,3 +610,9 @@
color-9: rgb(130, 31, 0);
color-9: color(display-p3 0.48896 0.1211 0);
}

.test-property-with-var {
--opacity: 1;
color: rgba(87, 107, 149, 1);
color: rgba(87, 107, 149, var(--opacity));
}
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@
text-indent: 2em;
content: var(--value-2ic);
left: 2em;
left: var(--non-existing, 2ic);
left: var(--non-existing, 2em);
width: calc(8em + 20px);
height: 10px;
margin: 0.5em 1em .2em;
Expand Down Expand Up @@ -593,7 +593,7 @@

@supports (background: linear-gradient(in oklch, red 0%, red 0% 1%, red 2%)) and (color: hsl(0 0% 0% / 0)) {
.gradients-interpolation-method {
--background-image: linear-gradient(in oklch decreasing hue, hsl(0, 85%, 75%) 0%, hsl(180, 80%, 65%) 100%);
--background-image: linear-gradient(in oklch decreasing hue, hsl(0deg 85% 75%) 0%, hsl(180deg 80% 65%) 100%);
}
}

Expand All @@ -610,3 +610,9 @@
color-9: rgb(130, 31, 0);
color-9: color(display-p3 0.48896 0.1211 0);
}

.test-property-with-var {
--opacity: 1;
color: rgba(87, 107, 149, 1);
color: rgba(87, 107, 149, var(--opacity));
}
10 changes: 8 additions & 2 deletions plugin-packs/postcss-preset-env/test/basic.ch38.expect.css
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@
text-indent: 2em;
content: var(--value-2ic);
left: 2em;
left: var(--non-existing, 2ic);
left: var(--non-existing, 2em);
width: calc(8em + 20px);
height: 10px;
margin: 0.5em 1em .2em;
Expand Down Expand Up @@ -503,7 +503,7 @@

@supports (background: linear-gradient(in oklch, red 0%, red 0% 1%, red 2%)) and (color: hsl(0 0% 0% / 0)) {
.gradients-interpolation-method {
--background-image: linear-gradient(in oklch decreasing hue, hsl(0, 85%, 75%) 0%, hsl(180, 80%, 65%) 100%);
--background-image: linear-gradient(in oklch decreasing hue, hsl(0deg 85% 75%) 0%, hsl(180deg 80% 65%) 100%);
}
}

Expand All @@ -520,3 +520,9 @@
color-9: rgb(130, 31, 0);
color-9: color(display-p3 0.48896 0.1211 0);
}

.test-property-with-var {
--opacity: 1;
color: rgba(87, 107, 149, 1);
color: rgba(87, 107, 149, var(--opacity));
}
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ h1.test-custom-selectors:not(.does-not-exist), h2.test-custom-selectors:not(.doe

@supports (background: linear-gradient(in oklch, red 0%, red 0% 1%, red 2%)) and (color: hsl(0 0% 0% / 0)) {
.gradients-interpolation-method {
--background-image: linear-gradient(in oklch decreasing hue, hsl(0, 85%, 75%) 0%, hsl(180, 80%, 65%) 100%);
--background-image: linear-gradient(in oklch decreasing hue, hsl(0deg 85% 75%) 0%, hsl(180deg 80% 65%) 100%);
}
}

Expand All @@ -518,3 +518,8 @@ h1.test-custom-selectors:not(.does-not-exist), h2.test-custom-selectors:not(.doe
color-9: rgb(130, 31, 0);
color-9: color(display-p3 0.48896 0.1211 0);
}

.test-property-with-var {
--opacity: 1;
color: rgba(87, 107, 149, var(--opacity));
}
Original file line number Diff line number Diff line change
Expand Up @@ -512,3 +512,8 @@ h1.test-custom-selectors:not(.does-not-exist), h2.test-custom-selectors:not(.doe
color-9: rgb(130, 31, 0);
color-9: color(display-p3 0.48896 0.1211 0);
}

.test-property-with-var {
--opacity: 1;
color: rgba(87 107 149 / var(--opacity));
}
Original file line number Diff line number Diff line change
Expand Up @@ -512,3 +512,8 @@ h1.test-custom-selectors:not(.does-not-exist), h2.test-custom-selectors:not(.doe
color-9: rgb(130, 31, 0);
color-9: color(display-p3 0.48896 0.1211 0);
}

.test-property-with-var {
--opacity: 1;
color: rgba(87 107 149 / var(--opacity));
}
5 changes: 5 additions & 0 deletions plugin-packs/postcss-preset-env/test/basic.css
Original file line number Diff line number Diff line change
Expand Up @@ -465,3 +465,8 @@
color-8: oklab(from oklab(40% 0.566 0.39) l a b);
color-9: oklch(from oklch(40% 0.566 39deg) l c h);
}

.test-property-with-var {
--opacity: 1;
color: rgba(87 107 149 / var(--opacity));
}
10 changes: 8 additions & 2 deletions plugin-packs/postcss-preset-env/test/basic.expect.css
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@
text-indent: 2em;
content: var(--value-2ic);
left: 2em;
left: var(--non-existing, 2ic);
left: var(--non-existing, 2em);
width: calc(8em + 20px);
height: 10px;
margin: 0.5em 1em .2em;
Expand Down Expand Up @@ -612,7 +612,7 @@

@supports (background: linear-gradient(in oklch, red 0%, red 0% 1%, red 2%)) and (color: hsl(0 0% 0% / 0)) {
.gradients-interpolation-method {
--background-image: linear-gradient(in oklch decreasing hue, hsl(0, 85%, 75%) 0%, hsl(180, 80%, 65%) 100%);
--background-image: linear-gradient(in oklch decreasing hue, hsl(0deg 85% 75%) 0%, hsl(180deg 80% 65%) 100%);
}
}

Expand All @@ -629,3 +629,9 @@
color-9: rgb(130, 31, 0);
color-9: color(display-p3 0.48896 0.1211 0);
}

.test-property-with-var {
--opacity: 1;
color: rgba(87, 107, 149, 1);
color: rgba(87, 107, 149, var(--opacity));
}
7 changes: 6 additions & 1 deletion plugin-packs/postcss-preset-env/test/basic.ff49.expect.css
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@

@supports (background: linear-gradient(in oklch, red 0%, red 0% 1%, red 2%)) and (color: hsl(0 0% 0% / 0)) {
.gradients-interpolation-method {
--background-image: linear-gradient(in oklch decreasing hue, hsl(0, 85%, 75%) 0%, hsl(180, 80%, 65%) 100%);
--background-image: linear-gradient(in oklch decreasing hue, hsl(0deg 85% 75%) 0%, hsl(180deg 80% 65%) 100%);
}
}

Expand All @@ -521,3 +521,8 @@
color-9: rgb(130, 31, 0);
color-9: color(display-p3 0.48896 0.1211 0);
}

.test-property-with-var {
--opacity: 1;
color: rgba(87, 107, 149, var(--opacity));
}
5 changes: 5 additions & 0 deletions plugin-packs/postcss-preset-env/test/basic.ff66.expect.css
Original file line number Diff line number Diff line change
Expand Up @@ -516,3 +516,8 @@
color-9: rgb(130, 31, 0);
color-9: color(display-p3 0.48896 0.1211 0);
}

.test-property-with-var {
--opacity: 1;
color: rgba(87 107 149 / var(--opacity));
}
10 changes: 8 additions & 2 deletions plugin-packs/postcss-preset-env/test/basic.hebrew.expect.css
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ h1.test-custom-selectors:not(.does-not-exist), h2.test-custom-selectors:not(.doe
text-indent: 2em;
content: var(--value-2ic);
left: 2em;
left: var(--non-existing, 2ic);
left: var(--non-existing, 2em);
width: calc(8em + 20px);
height: 10px;
margin: 0.5em 1em .2em;
Expand Down Expand Up @@ -608,7 +608,7 @@ h1.test-custom-selectors:not(.does-not-exist), h2.test-custom-selectors:not(.doe

@supports (background: linear-gradient(in oklch, red 0%, red 0% 1%, red 2%)) and (color: hsl(0 0% 0% / 0)) {
.gradients-interpolation-method {
--background-image: linear-gradient(in oklch decreasing hue, hsl(0, 85%, 75%) 0%, hsl(180, 80%, 65%) 100%);
--background-image: linear-gradient(in oklch decreasing hue, hsl(0deg 85% 75%) 0%, hsl(180deg 80% 65%) 100%);
}
}

Expand All @@ -625,3 +625,9 @@ h1.test-custom-selectors:not(.does-not-exist), h2.test-custom-selectors:not(.doe
color-9: rgb(130, 31, 0);
color-9: color(display-p3 0.48896 0.1211 0);
}

.test-property-with-var {
--opacity: 1;
color: rgba(87, 107, 149, 1);
color: rgba(87, 107, 149, var(--opacity));
}
10 changes: 8 additions & 2 deletions plugin-packs/postcss-preset-env/test/basic.ie10.expect.css
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@
text-indent: 2em;
content: var(--value-2ic);
left: 2em;
left: var(--non-existing, 2ic);
left: var(--non-existing, 2em);
width: calc(8em + 20px);
height: 10px;
margin: 0.5em 1em .2em;
Expand Down Expand Up @@ -629,7 +629,7 @@

@supports (background: linear-gradient(in oklch, red 0%, red 0% 1%, red 2%)) and (color: hsl(0 0% 0% / 0)) {
.gradients-interpolation-method {
--background-image: linear-gradient(in oklch decreasing hue, hsl(0, 85%, 75%) 0%, hsl(180, 80%, 65%) 100%);
--background-image: linear-gradient(in oklch decreasing hue, hsl(0deg 85% 75%) 0%, hsl(180deg 80% 65%) 100%);
}
}

Expand All @@ -646,3 +646,9 @@
color-9: rgb(130, 31, 0);
color-9: color(display-p3 0.48896 0.1211 0);
}

.test-property-with-var {
--opacity: 1;
color: rgba(87, 107, 149, 1);
color: rgba(87, 107, 149, var(--opacity));
}
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ h1.test-custom-selectors:not(.does-not-exist), h2.test-custom-selectors:not(.doe
text-indent: 2em;
content: var(--value-2ic);
left: 2em;
left: var(--non-existing, 2ic);
left: var(--non-existing, 2em);
width: calc(8em + 20px);
height: 10px;
margin: 0.5em 1em .2em;
Expand Down Expand Up @@ -610,7 +610,7 @@ h1.test-custom-selectors:not(.does-not-exist), h2.test-custom-selectors:not(.doe

@supports (background: linear-gradient(in oklch, red 0%, red 0% 1%, red 2%)) and (color: hsl(0 0% 0% / 0)) {
.gradients-interpolation-method {
--background-image: linear-gradient(in oklch decreasing hue, hsl(0, 85%, 75%) 0%, hsl(180, 80%, 65%) 100%);
--background-image: linear-gradient(in oklch decreasing hue, hsl(0deg 85% 75%) 0%, hsl(180deg 80% 65%) 100%);
}
}

Expand All @@ -627,3 +627,9 @@ h1.test-custom-selectors:not(.does-not-exist), h2.test-custom-selectors:not(.doe
color-9: rgb(130, 31, 0);
color-9: color(display-p3 0.48896 0.1211 0);
}

.test-property-with-var {
--opacity: 1;
color: rgba(87, 107, 149, 1);
color: rgba(87, 107, 149, var(--opacity));
}
Original file line number Diff line number Diff line change
Expand Up @@ -471,3 +471,8 @@
color-8: oklab(from oklab(40% 0.566 0.39) l a b);
color-9: oklch(from oklch(40% 0.566 39deg) l c h);
}

.test-property-with-var {
--opacity: 1;
color: rgba(87 107 149 / var(--opacity));
}
10 changes: 8 additions & 2 deletions plugin-packs/postcss-preset-env/test/basic.op_mini.expect.css
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ h1.test-custom-selectors:not(.does-not-exist), h2.test-custom-selectors:not(.doe
text-indent: 2em;
content: var(--value-2ic);
left: 2em;
left: var(--non-existing, 2ic);
left: var(--non-existing, 2em);
width: calc(8em + 20px);
height: 10px;
margin: 0.5em 1em .2em;
Expand Down Expand Up @@ -590,7 +590,7 @@ h1.test-custom-selectors:not(.does-not-exist), h2.test-custom-selectors:not(.doe

@supports (background: linear-gradient(in oklch, red 0%, red 0% 1%, red 2%)) and (color: hsl(0 0% 0% / 0)) {
.gradients-interpolation-method {
--background-image: linear-gradient(in oklch decreasing hue, hsl(0, 85%, 75%) 0%, hsl(180, 80%, 65%) 100%);
--background-image: linear-gradient(in oklch decreasing hue, hsl(0deg 85% 75%) 0%, hsl(180deg 80% 65%) 100%);
}
}

Expand All @@ -607,3 +607,9 @@ h1.test-custom-selectors:not(.does-not-exist), h2.test-custom-selectors:not(.doe
color-9: rgb(130, 31, 0);
color-9: color(display-p3 0.48896 0.1211 0);
}

.test-property-with-var {
--opacity: 1;
color: rgba(87, 107, 149, 1);
color: rgba(87, 107, 149, var(--opacity));
}
Original file line number Diff line number Diff line change
Expand Up @@ -788,3 +788,8 @@ h1.test-custom-selectors:not(.does-not-exist), h2.test-custom-selectors:not(.doe
color-9: rgb(130, 31, 0);
color-9: color(display-p3 0.48896 0.1211 0);
}

.test-property-with-var {
--opacity: 1;
color: rgba(87, 107, 149, var(--opacity));
}
Loading