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

Nested @media rules render different from Ruby SASS #185

Closed
mgreter opened this issue Nov 14, 2013 · 11 comments · Fixed by #800
Closed

Nested @media rules render different from Ruby SASS #185

mgreter opened this issue Nov 14, 2013 · 11 comments · Fixed by #800

Comments

@mgreter
Copy link
Contributor

mgreter commented Nov 14, 2013

Hi everybody

Nested @media rules are not rendered the same as with Ruby SASS.

Source SCSS File:

@media only screen and (max-width : 100px) {
    .outer { width: 10px; }
    @media only screen and (max-width : 200px) {
        .inner { width: 20px; }
    }
}

Libsass output:

@media only screen and (max-width: 100px) {
  .outer {
    width: 10px; }
  @media only screen and (max-width: 200px) {
    .inner {
      width: 20px; } } }

Ruby SASS output:

@media only screen and (max-width: 100px) {
  .outer {
    width: 10px; } }
@media only screen and (max-width: 100px) and (max-width: 200px) {
  .inner {
    width: 20px; } }

Although libsass output is valid css3, it's not valid css2.1.
For some more info see: http://stackoverflow.com/a/11747166

Thanks and have a nice day!

@akhleung
Copy link

Hmm, looks like Sass does some boolean algebra on nested media queries ... thanks for the report!

@lunelson
Copy link

Also with nesting retina media queries inside a width query. This Sassmeister gist illustrates it: if you switch compilers in the control panel you can see how ruby-sass 3.3 combines them correctly but libsass simply writes it out nested:

http://sassmeister.com/gist/8914969

@timbz
Copy link

timbz commented Mar 24, 2014

the ruby code should be in Query::merge()
https://github.com/nex3/sass/blob/stable/lib/sass/media.rb

@JeroenVdb
Copy link

Does someone have a (temporarily) workaround for this problem?

@DedRain
Copy link

DedRain commented Aug 8, 2014

Hi all, any progress with this?

@HamptonMakes
Copy link
Member

I'm going to open a new issue on this, since the second one seems like a different issue.

@HamptonMakes
Copy link
Member

Oh shit, totally misread this. Sorry, I thought that was a merge against the original issue above. Sorry, missed that it's never been addressed at all.

@xzyfer
Copy link
Contributor

xzyfer commented Dec 9, 2014

I've started looking into this. It's one of the few major blockers IMHO.

@xzyfer
Copy link
Contributor

xzyfer commented Jan 17, 2015

This fixed via #800 and will be in 3.2.

@msikma
Copy link

msikma commented Feb 10, 2015

I'm very glad this will be fixed with 3.2, this will make it easy to do e.g. retina-specific code inside code blocks for specific responsive sizes. Hoping the next release is finalized soon, any guesses as to when it'll be ready?

@xzyfer
Copy link
Contributor

xzyfer commented Feb 15, 2015

@msikma it's hard to say at the moment. You can #812 to keep up to date on the 3.2 release.

@HamptonMakes HamptonMakes changed the title Nested @media rules render different from Ruby SASS Nested @media rules render different from Ruby SASS [$15] Feb 21, 2015
@HamptonMakes HamptonMakes changed the title Nested @media rules render different from Ruby SASS [$15] Nested @media rules render different from Ruby SASS Jan 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants