Skip to content

Commit e3211fa

Browse files
authored
fix(postcss-convert-values): preserve percent sign in percentage values in at-rules with double quotes (#1695)
1 parent 70cffd5 commit e3211fa

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

CONTRIBUTORS.md

+1
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,4 @@ Thanks goes to these wonderful people:
7272
- Xiaojun Zhou
7373
- Seth Falco
7474
- Seiya
75+
- Aleksandr Kondrashov

packages/postcss-convert-values/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ function shouldKeepZeroUnit(decl, browsers) {
157157
(node) =>
158158
node.type === 'decl' &&
159159
node.prop.toLowerCase() === 'syntax' &&
160-
node.value === "'<percentage>'"
160+
(node.value === "'<percentage>'" || node.value === '"<percentage>"')
161161
)) ||
162162
keepWhenZero.has(lowerCasedProp)
163163
);

packages/postcss-convert-values/test/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,14 @@ test(
504504
)
505505
);
506506

507+
test(
508+
`should not strip the percentage from 0 in @property, for initial-value (syntax string in double quotes)`,
509+
processCSS(
510+
`@property --percent{syntax:"<percentage>";inherits:false;initial-value:0%;}`,
511+
`@property --percent{syntax:"<percentage>";inherits:false;initial-value:0%;}`
512+
)
513+
);
514+
507515
test(
508516
'should not strip the percentage from background-color',
509517
passthroughCSS('background-color:color-mix(#000, #FFF 0%);')

packages/postcss-minify-selectors/test/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ test(
109109
processCSS(
110110
'.item1, .item2, .item10, .item11{color:blue}',
111111
'.item1,.item2,.item10,.item11{color:blue}',
112-
{ sort: false },
112+
{ sort: false }
113113
)
114114
);
115115

0 commit comments

Comments
 (0)