-
-
Notifications
You must be signed in to change notification settings - Fork 722
fix(transformer/styled-components): remove repeat whitespace in CSS minification #13369
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
fix(transformer/styled-components): remove repeat whitespace in CSS minification #13369
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes CSS minification in the styled-components transformer by removing multiple consecutive whitespace characters before CSS delimiters ({, }, ,, ;), not just single spaces as the previous implementation did.
- Enhanced whitespace compression logic to consume all consecutive whitespace characters
- Added test case to verify the fix handles multiple spaces and various whitespace patterns
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/oxc_transformer/src/plugins/styled_components.rs | Updated minification logic to consume all consecutive whitespace instead of single characters |
| tasks/transform_conformance/tests/plugin-styled-components/test/fixtures/minify-whitespace-repeated/input.js | Test input with multiple spaces and whitespace patterns before CSS delimiters |
| tasks/transform_conformance/tests/plugin-styled-components/test/fixtures/minify-whitespace-repeated/output.js | Expected output showing properly minified CSS with whitespace removed |
| tasks/transform_conformance/tests/plugin-styled-components/test/fixtures/minify-whitespace-repeated/options.json | Babel configuration for the test case |
| tasks/transform_conformance/snapshots/oxc.snap.md | Updated test count reflecting the new passing test |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
CodSpeed Instrumentation Performance ReportMerging #13369 will degrade performances by 10.72%Comparing Summary
Benchmarks breakdown
Footnotes |
f5196e5 to
0b252d8
Compare
Merge activity
|
0b252d8 to
35d83ca
Compare

Follow-on after #13346. Remove multiple spaces preceding
{,},,, or;.Previously we removed a single space, but wouldn't remove multiple whitespace characters in a row.