Skip to content
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

Minify css: range selector media queries/container queries #386

Open
hajerty opened this issue Mar 11, 2024 · 5 comments
Open

Minify css: range selector media queries/container queries #386

hajerty opened this issue Mar 11, 2024 · 5 comments
Assignees

Comments

@hajerty
Copy link

hajerty commented Mar 11, 2024

Hi, I'm using 1.20.0.0 and I'm finding a problem when I try to minify a css file with media queries rules.
In detail, I have this rule @container (min-width: 480px) and (max-width: 1024px) and the minified version is @container (min-width: 480px) and(max-width: 1024px) .

To minify I use this code: NUglify.Uglify.Css(text) without any setting.

Could you help me to find a way to avoid that the space after the and word is cancelled?
Thanks

@trullock
Copy link
Owner

@container is completely unsupported as its a relatively new CSS feature.

PR welcome

Modify CssScanner.cs and add "CONTAINER" support to ScanAtKeyword(), then CssParser.cs needs a method to handle it called from at least ParseStylesheet()

@DarthSonic
Copy link

Very similar issue here:

@container fooName (min-width: 480px)
gets
@container fooName(min-width: 480px)

missing a space after fooName and therefore becoming invalid syntax.

@trullock
Copy link
Owner

trullock commented Apr 1, 2024

Yeah it's probably the same fix.

PRs welcome

@Chlorobyte-but-real
Copy link

Same issue can be reproduced with @media not (prefers-color-scheme: dark)

@trullock
Copy link
Owner

trullock commented Jun 9, 2024

Thanks for the extra test case. Again PRs welcome

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

No branches or pull requests

4 participants