Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.

Commit 7b9b84b

Browse files
committed
8.0.9
1 parent e0081bf commit 7b9b84b

8 files changed

+35
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes to PostCSS Custom Properties
22

3+
### 8.0.9 (November 5, 2018)
4+
5+
- Fixed: Issue with duplicate custom property usage within a declaration
6+
37
### 8.0.8 (October 2, 2018)
48

59
- Fixed: Issue with nested fallbacks

lib/transform-value-ast.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ export default function transformValueAST(root, customProperties) {
88

99
if (name in customProperties) {
1010
// conditionally replace a known custom property
11-
child.replaceWith(...asClonedArrayWithBeforeSpacing(customProperties[name], child.raws.before));
11+
const nodes = asClonedArrayWithBeforeSpacing(customProperties[name], child.raws.before);
1212

13-
retransformValueAST(root, customProperties, name);
13+
child.replaceWith(...nodes);
14+
15+
retransformValueAST({ nodes }, customProperties, name);
1416
} else if (fallbacks.length) {
1517
// conditionally replace a custom property with a fallback
1618
const index = root.nodes.indexOf(child);
@@ -24,7 +26,7 @@ export default function transformValueAST(root, customProperties) {
2426
} else {
2527
transformValueAST(child, customProperties);
2628
}
27-
})
29+
});
2830
}
2931

3032
return root;

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postcss-custom-properties",
3-
"version": "8.0.8",
3+
"version": "8.0.9",
44
"description": "Use Custom Properties Queries in CSS",
55
"author": "Jonathan Neal <[email protected]>",
66
"contributors": [
@@ -37,11 +37,11 @@
3737
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
3838
"@babel/preset-env": "^7.1.0",
3939
"babel-eslint": "^10.0.1",
40-
"eslint": "^5.6.1",
40+
"eslint": "^5.8.0",
4141
"eslint-config-dev": "^2.0.0",
4242
"postcss-tape": "^2.2.0",
4343
"pre-commit": "^1.2.2",
44-
"rollup": "^0.66.2",
44+
"rollup": "^0.67.0",
4545
"rollup-plugin-babel": "^4.0.3"
4646
},
4747
"eslintConfig": {

test/basic.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,7 @@ html {
4242
.text--calc {
4343
width: calc((100% - var(--xxx, 1px)) + var(--yyy, 10px));
4444
}
45+
46+
.test--linear-gradient {
47+
background-image: linear-gradient(to right, var(--color, transparent) 0%, var(--color, transparent) 100%);
48+
}

test/basic.expect.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,8 @@ html {
4949
width: calc((100% - 1px) + 10px);
5050
width: calc((100% - var(--xxx, 1px)) + var(--yyy, 10px));
5151
}
52+
53+
.test--linear-gradient {
54+
background-image: linear-gradient(to right, rgb(255, 0, 0) 0%, rgb(255, 0, 0) 100%);
55+
background-image: linear-gradient(to right, var(--color, transparent) 0%, var(--color, transparent) 100%);
56+
}

test/basic.import-is-empty.expect.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,8 @@ html {
4949
width: calc((100% - 1px) + 10px);
5050
width: calc((100% - var(--xxx, 1px)) + var(--yyy, 10px));
5151
}
52+
53+
.test--linear-gradient {
54+
background-image: linear-gradient(to right, rgb(255, 0, 0) 0%, rgb(255, 0, 0) 100%);
55+
background-image: linear-gradient(to right, var(--color, transparent) 0%, var(--color, transparent) 100%);
56+
}

test/basic.import.expect.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,8 @@ html {
5050
width: calc((100% - 1px) + 10px);
5151
width: calc((100% - var(--xxx, 1px)) + var(--yyy, 10px));
5252
}
53+
54+
.test--linear-gradient {
55+
background-image: linear-gradient(to right, rgb(255, 0, 0) 0%, rgb(255, 0, 0) 100%);
56+
background-image: linear-gradient(to right, var(--color, transparent) 0%, var(--color, transparent) 100%);
57+
}

test/basic.preserve.expect.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,7 @@
3434
.text--calc {
3535
width: calc((100% - 1px) + 10px);
3636
}
37+
38+
.test--linear-gradient {
39+
background-image: linear-gradient(to right, rgb(255, 0, 0) 0%, rgb(255, 0, 0) 100%);
40+
}

0 commit comments

Comments
 (0)