Skip to content

fix(postcss-convert-values): preserve percent sign in percentage values in at-rules with double quotes #1695

Merged
ludofischer merged 1 commit intocssnano:masterfrom
aramikuto:fix-initial-value-percent
May 6, 2025
Merged

fix(postcss-convert-values): preserve percent sign in percentage values in at-rules with double quotes #1695
ludofischer merged 1 commit intocssnano:masterfrom
aramikuto:fix-initial-value-percent

Conversation

@aramikuto
Copy link
Copy Markdown
Contributor

Fixes #1694

The shouldKeepZeroUnit check previously expected the syntax value <percentage> to be enclosed only in single quotes. However, in CSS, string values can also be surrounded by double quotes. I've added an additional check to handle both quote styles and updated the test cases to include the double-quoted variant.

NOTE: I didn't change any logic in packages/postcss-minify-selectors/test/index.js, but the file was automatically updated after running the pnpm fixlint command.

@alexander-akait
Copy link
Copy Markdown
Member

/cc @ludofischer can you help me with the release after merge this?

@codecov
Copy link
Copy Markdown

codecov bot commented May 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.54%. Comparing base (9e9e111) to head (fde4c5d).
Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1695   +/-   ##
=======================================
  Coverage   98.54%   98.54%           
=======================================
  Files         122      122           
  Lines       10388    10388           
  Branches       18       18           
=======================================
  Hits        10237    10237           
  Misses        151      151           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ludofischer
Copy link
Copy Markdown
Collaborator

@alexander-akait Yes I can release after merging this if you want

@ludofischer ludofischer merged commit e3211fa into cssnano:master May 6, 2025
12 checks passed
@alexander-akait
Copy link
Copy Markdown
Member

@ludofischer Thank you

@Multiply
Copy link
Copy Markdown
Contributor

Multiply commented May 12, 2025

Related to this, but shouldn't it also keep the % for <length-percentage>? (MDN reference)

While investigating tailwindlabs/tailwindcss#17977 I found this PR in the hopes it would solve my issue too, but I just noticed this is just about different ways of quoting percentage, and it doesn't account for my syntax.

Edit: I've added a PR to solve it here: #1702

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Invalid initial-value for custom CSS percentage property

4 participants