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

Media Query issue #117

Closed
lukeapage opened this issue Jul 8, 2013 · 4 comments
Closed

Media Query issue #117

lukeapage opened this issue Jul 8, 2013 · 4 comments
Assignees

Comments

@lukeapage
Copy link
Contributor

Hi,

I'm part of the less core team. We always had an option to compress with yui-compressor, but due to lack of support for that we are looking at moving to a different npm package.

We had a bug raised about the existing compressor which is what brought this about. However testing with clean css has produced some strange results (I think). Apologies if there is a reason for this.

With this input from less

@media print, (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
  /* Style adjustments for high resolution devices */
}
/**===================================================**\
/**  PRINT STYLES
/**===================================================**/
@media only print {
  a,
  a:visited {
    text-decoration: underline;
  }
  a[href]:after {
    content: " (" attr(href) ")";
  }
  abbr[title]:after {
    content: " (" attr(title) ")";
  }
  /** MANUALLY TRUNCATED FOR BREVITY **/
}

we get

@media print,(-o-min-device-pixel-ratio:5/4),(-webkit-min-device-pixel-ratio:1.25),(min-resolution:120dpi){}/ @media only print{a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}}
  1. what is the / about? It seems to be caused by using \ instead of / at the end of the comment.. it seems to be making clean-css get confused
  2. could you save space by removing empty media blocks?
@GoalSmashers
Copy link
Contributor

Hi @lukeapage,

  1. It's indeed suspicious and probably a bug in clean-css comment stripping code. We will issue a fix later today.
  2. We should do it as well (as we have cleaning up empty selectors now) - I'll open a new bug regarding this shortly.

Thanks for raising both issues,
Jakub @ GoalSmashers.com

@GoalSmashers
Copy link
Contributor

@lukeapage clean-css 1.0.11 is out with the fix due to wrong optimizations ordering. As it turns out the 2nd issue you experienced was due to a fact that clean-css removes empty selectors only if asked to (as that's an expensive optimization). Just use -e or removeEmpty: true when calling from command line or JavaScript respectively.

@XhmikosR
Copy link
Contributor

@GoalSmashers: Isn't this issue fixed then?

@GoalSmashers
Copy link
Contributor

It is, good catch!

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

3 participants