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

Squashing unnecessary media queries during minification #3226

Closed
JWo1F opened this issue Jul 12, 2023 · 0 comments
Closed

Squashing unnecessary media queries during minification #3226

JWo1F opened this issue Jul 12, 2023 · 0 comments

Comments

@JWo1F
Copy link

JWo1F commented Jul 12, 2023

Problem:

When I use some framework to generate styles (tailwind, for example), I can get the following styles as output:

@media (min-width: 1024px) {
  .md\:class {
    color: red;
  }
  @media (min-width: 1024px) {
    .md\:class {
      color: blue;
    }
  }
}

Solution:

It can be seen that the final version should be as follows:

@media (min-width: 1024px) {
  .md\:class {
    color: blue;
  }
}

When minifying css, it would be very nice to collapse such constructs. This will definitely reduce the output file and the problem is related to the minifier, not to the css framework, as it is quite valid css that can (and should) be compressed.

[See esbuild try example here]

What do you think about it?

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

2 participants