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 break css support #392

Open
tpetry opened this issue Dec 23, 2021 · 3 comments
Open

Nested @media break css support #392

tpetry opened this issue Dec 23, 2021 · 3 comments

Comments

@tpetry
Copy link

tpetry commented Dec 23, 2021

The CSS3 spec allows nested media queries, but juice has problems handling them. The closing bracket is lost after transformation.

Input:

<style type="text/css">
@media (min-width: 640px) {
  .sm\:container {
    width: 100%
  }

  @media (min-width: 640px) {
    .sm\:container {
      max-width: 640px
    }
  }
}

p {
    background-color: red;
}
</style>
<p>Test123</p>

Result:

Error: Unexpected } (line 12, char 1)
<style type="text/css">
@media (min-width: 640px) {
  .sm\:container {
    width: 100%
  }

  @media (min-width: 640px) {
    .sm\:container {
      max-width: 640px
    }
  }

p {
    background-color: red;
}
</style>
<p style="background-color: red;">Test123</p>
@jrit
Copy link
Collaborator

jrit commented Dec 28, 2021

thanks for the suggestion, would love a PR to make this work.

@filoscoder
Copy link

I think this will solve it
#442

@gieoon
Copy link

gieoon commented Feb 10, 2023

I've made a PR for this. Hopefully it gets through and mensch gets updated.
The issue isn't with SASS syntax, but with closing brackets not getting parsed properly. With that said, a different parser might be able to handle this issue more effectively.

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