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
[CSS] bug when handling var(foo) #5407
Comments
For context, @wangxd18 is a Facebook employee and it was found in the Facebook codebase. |
The problematic thing here is that the example is invalid CSS.
Why are you using invalid CSS? |
See also: #4224 (duplicate?) |
This might be a Facebook specific issue. FB has css preprocesser that will replace these What's the best way to handle this non-standard issue? |
@lydell I'm curious, since it's not valid CSS, would it make sense to keep it as it is written? This won't break anyone and help out Facebook. It also doesn't seem unreasonable to have it kept that way. |
Yeah, I guess we could try to keep it as written. Just wanted to make sure this is something worth doing something about on Prettier's side first (it could have been a mistake). (CSS is difficult since we support an arbitrary superset of the standard, which forces us to apply "garbage in, garbage out" instead of throwing parse errors sometimes, and it's not easy to to know what's garbage and what's not.) |
It is hard to fix it, logic around spaces based on prev, current and next types (i.e. function/number with unit/variable and etc), it is allow add spaces for math operators in Less and Sass and in |
Prettier 1.15.1
Playground link
Input:
Output:
Note the extra space after
var(transition-time)
.The text was updated successfully, but these errors were encountered: