Skip to content

fix(css): preserve spaces around >= and <= in media query range opera… - #2457

Open
Arpit-mohankar wants to merge 3 commits into
beautifier:mainfrom
Arpit-mohankar:fix/css-media-query-range-operator-spacing
Open

fix(css): preserve spaces around >= and <= in media query range opera…#2457
Arpit-mohankar wants to merge 3 commits into
beautifier:mainfrom
Arpit-mohankar:fix/css-media-query-range-operator-spacing

Conversation

@Arpit-mohankar

Copy link
Copy Markdown

Fixes #2164

What: CSS beautifier was stripping the space after >= and <= operators in @media range queries.

Before: @media (width >= 90rem)@media (width >=90rem)

After: @media (width >= 90rem)@media (width >= 90rem)

Also normalizes minified input:

  • @media (width>=90rem)@media (width >= 90rem)

Changes:

  • js/src/css/beautifier.js — added compound >=/<= handler inside parentheses
  • python/cssbeautifier/css/beautifier.py — mirrored fix in Python
  • test/data/css/tests.js — added 4 test cases covering spaced and minified input

…tors

Fixes beautifier#2164

Fixes the CSS beautifier collapsing space after range operators
(>= <=) inside @media query conditions.

Before: @media (width >= 90rem) -> @media (width >=90rem)
After:  @media (width >= 90rem) -> @media (width >= 90rem)

Also normalizes minified input:
  @media (width>=90rem) -> @media (width >= 90rem)

Fixed in both JS and Python implementations.
@Arpit-mohankar

Copy link
Copy Markdown
Author

"First-time contributor here, happy to make any changes needed. Please approve the workflows to run CI. Thanks!"

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.

Media query range context has undesirable spaces after formatting

2 participants