question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nested media queries using the "not" keyword should not be merged

See original GitHub issue

Edited by @nex3

Specs: https://github.com/sass/sass-spec/pull/1267


Nested media queries using the not keyword should not be merged. According to the spec, not flips the result for the entire query and does not apply to specific chunks.

For example:

@media (min-width: 500px) {
  @media not all and (min-width: 800px) {
    background: red;
  }
 }

Should compile to the same:

@media (min-width: 500px) {
  @media not all and (min-width: 800px) {
    background: red;
  }
 }

At 400px the background is expectedly not red.

Instead it compiles to:

@media not all and (min-width: 500px) and (min-width: 800px) {
  background: red;
}

At 400px the background is unexpectedly red.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nex3commented, Jul 13, 2018

This is a straightforward enough change that I don’t think it needs a full proposal. @xzyfer agreed?

0reactions
nex3commented, Nov 5, 2020

Closing this out since LibSass is deprecated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using media queries - CSS: Cascading Style Sheets | MDN
The and operator can also combine multiple media features into a single media query. The not operator, meanwhile, negates a media query, ...
Read more >
How to get a SASS nested nested media query to work with ...
This appears to be a case of Sass trying to write something that resembles a valid media query (since it knows that screen...
Read more >
Sass Mixin and Media Merging - SitePoint
Pretty handy, isn't it? This is what is called media merging. When nested media queries are merged into a single statement. What do...
Read more >
Media Queries Level 4 - W3C
1. Negating a Media Query: the not keyword. An individual media query can have its result negated by prefixing it with the keyword...
Read more >
Nested Media Queries - CSS-Tricks
You can nest media queries in native CSS, as long as you're doing it from the root. It's funny to see in native...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found