Skip to content

Panic in Minifier::minify due to nested selectors #16

Description

@NTBBloodbath

Hi, I just started using this library and I found a bug that causes the library to panic. This is related to the & nested selectors, maybe the library doesn't support its use?

For example, trying to minify the following CSS code will result in a panic:

#desc > a,
#discord-link > a,
#github-pages > a,
#github-issues > a {
  color: var(--color-blue-400);
  &:hover {
    text-decoration: underline;
  }
}

That code is the equivalent of doing the following and in this case it does work (although it is not very idiomatic in modern CSS):

#desc > a,
#discord-link > a,
#github-pages > a,
#github-issues > a {
  color: var(--color-blue-400);
}

#desc > a:hover,
#discord-link > a:hover,
#github-pages > a:hover,
#github-issues > a:hover {
  text-decoration: underline;
}

Panic logs (using a debug build):

thread 'main' panicked at src/cmd/build.rs:149:22:
called `Result::unwrap()` on an `Err` value: MError { message: "Invalid block at line 1:2", error: "\"#desc > a,\\n#discord-link > a,\\n#github-pages > a,\\n#github-issues > a {\\n  color: var(--color-blue-400);\\n  &:hover {\\n    text-decoration: underline;\\n  }\\n}\\n\"" }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions