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

CSS rules in media query are not minified like normal remaining css rules are #191

Open
adambullmer opened this issue May 4, 2018 · 0 comments

Comments

@adambullmer
Copy link

It would fantastic if CSS rules inside of media queries were minified in the same way that remaining css rules left in the page were. I believe the issue is in this block: https://github.com/peterbe/premailer/blob/master/premailer/premailer.py#L629-L634 as compared to the formatting happening above: https://github.com/peterbe/premailer/blob/master/premailer/premailer.py#L623

Consider the following contrived example:

.unused-class {
  font-size: 16px;
}

@media (max-width: 480px) {
  .unused-class {
    font-size: 14px;
  }
}

What I expect to happen:

The output of premailer would minify the css in a consistent manner:

.unused-class {font-size: 16px}
@media (max-width: 480px) {
  /* on a new line or not doesn't matter to me */
  .unused-class {font-size: 14px }
}

What actually happens:

The output of css rules inside of a media query are not rewritten

.unused-class {font-size: 16px}
@media (max-width: 480px) {
  .unused-class {
    font-size: 14px;
  }
}
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

No branches or pull requests

1 participant