8000 fix(postcss-convert-values): prserve percent sign in border-image-width by ludofischer · Pull Request #1645 · cssnano/cssnano · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(postcss-convert-values): prserve percent sign in border-image-width #1645

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
merged 1 commit into from
Jul 3, 2024
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
5 changes: 5 additions & 0 deletions .changeset/plenty-swans-explode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'postcss-convert-values': patch
---

fix(postcss-convert-values): preserve percent sign in border-image-width
8000 8 changes: 7 additions & 1 deletion packages/postcss-convert-values/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ const keepZeroPercentAlways = new Set([
'hsla',
'hwb',
]);

const keepZeroPercentageInKeyframe = new Set([
'border-image-width',
'stroke-dasharray',
]);

/**
* Numbers without digits after the dot are technically invalid,
* but in that case css-value-parser returns the dot as part of the unit,
Expand Down Expand Up @@ -130,7 +136,7 @@ function shouldKeepZeroUnit(decl, browsers) {
(decl.value.includes('%') &&
keepZeroPercentOnIE11.has(lowerCasedProp) &&
browsers.includes('ie 11')) ||
(lowerCasedProp === 'stroke-dasharray' &&
(keepZeroPercentageInKeyframe.has(lowerCasedProp) &&
parent &&
parent.parent &&
parent.parent.type === 'atrule' &&
Expand Down
5 changes: 5 additions & 0 deletions packages/postcss-convert-values/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,4 +509,9 @@ test(
passthroughCSS('box-shadow:inset 0 0 0 250pc hsla(0,0%,100%,.7215686275)')
);

test(
'should not strip percentage from border-image-width',
passthroughCSS('@keyframes test {0% {border-image-width: 0 0 100% 0%;}}')
);

test('should use the postcss plugin api', usePostCSSPlugin(plugin()));
2 changes: 1 addition & 1 deletion packages/postcss-convert-values/types/index.d.ts.map

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

Loading
0