Skip to content

Nested @media break css support #392

@tpetry

Description

@tpetry

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>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions