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

Incorrect handling of negated media queries (@media not ...) #2591

Open
kugland opened this issue Jun 9, 2021 · 1 comment
Open

Incorrect handling of negated media queries (@media not ...) #2591

kugland opened this issue Jun 9, 2021 · 1 comment

Comments

@kugland
Copy link

kugland commented Jun 9, 2021

Stylus v0.54.8 handles negated media queries (@media not ...) incorrectly.

Code:

@media all and (min-width: 10px)
  @media not all and (min-width: 20px)
    body
      background: red

@media all and (min-width: 10px)
  @media not screen and (min-width: 20px)
    body
      background: green

Transpiled CSS:

@media all and (min-width: 20px) and (min-width: 10px) {
  body {
    color: #f00;
  }
}
@media all and (min-width: 10px) and (min-width: 20px) {
  body {
    background: #008000;
  }
}

Expected CSS:

@media all and (min-width: 10px) {
  @media not all and (min-width: 20px) {
    body {
      background: #f00;
    }
  }
}
@media all and (min-width: 10px) {
  @media not screen and (min-width: 20px) {
    body {
      background: #008000;
    }
  }
}
@kugland kugland changed the title Incorrect handling of @media not Incorrect handling of @media not Jun 9, 2021
@kugland kugland changed the title Incorrect handling of @media not Incorrect handling of negated media queries (@media not ...) Jun 9, 2021
@conlanpatrek
Copy link

For what it's worth I'm seeing a similar issue with a simpler repro as of 0.55. My repro, without the nested media queries:

@media not all and (max-width: 1000px)
    body
        background red

No css is emitted at all here. Note that the correct css is emitted if you change the query from not all to not screen so I feel like there is a hint there.

Let me know if you feel it's unrelated enough for me to open a new ticket and I will.

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

4 participants