Parsing failure with minified `@media(xxx){...}` rule
Closed this issue · 1 comments
jdelStrother commented
My CSS minifier reduces this -
@media (prefers-color-scheme: dark) {
a { color: red; }
}
to this -
@media(prefers-color-scheme:dark){a{color:red}}
which CSSParser fails on, losing the @media
rule entirely:
parser = CssParser::Parser.new
parser.load_string! "@media(prefers-color-scheme:dark){a{color:red}}"
puts parser.to_s # => "a {\ncolor: red;\n}\n"
Including a space after @media
fixes it, so the bug is avoidable by altering my source to @media screen and (prefers-color-scheme: dark)
. @media(prefers-color-scheme:dark) { ... }
ought to be valid on its own though, right?
grosser commented
yeah it should be valid, thx for the bug report
I have no idea how to fix that though, so if you find a way please send a PR!