-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
Failed to parse css variables without trailing semicolon #250
Comments
The reason is that we are turning off Not sure how to best approach fixing that in a minimal amount of code - I'm crying when thinking about those CSS variable edge cases. |
I've always had a (╯°□°)╯︵ ┻━┻ vibe with those css variables edge cases. |
Just met the same issue, the easiest repro is below: Input.foo { --bar: var(--baz) } Output.foo {
--bar:var(--baz)}
}
;
} |
Although it is useable if you just add an explicit semicolon. @Andarist I think this issue is more important as is mentioned in frontity/frontity#753 than the css-variable edge case of |
Also i wonder what does the css spec say about |
Agreed that this is more important. Question is - is Stylis aiming to parse all valid CSS or are we not caring about edge cases like this? I'm fine with both - if we don't care then this should be mentioned in the docs. It's a fair tradeoff but has to be acknowledged.
Quite frankly - I don't want to dive deep figuring this out from the spec. I've checked 2 things though:
var s = document.createElement('style')
document.head.append(s)
s.sheet.insertRule(`h1{--example: {}`)
s.sheet.cssRules[0].cssText // "h1 { --example: {}; }" |
A better test for that would be var s = document.createElement('style')
document.body.append(s)
s.innerHTML = 'body{--example:{} body{background:red;}' Which results in body {
--example: {} body{background:red;}; Whereby |
Input:
Produces:
This corner case is reproducable in both 4.0.3 and 4.0.6.
Interestingly, there was no problem if simply replace
--min-height
withmin-height
:The text was updated successfully, but these errors were encountered: