-
-
Notifications
You must be signed in to change notification settings - Fork 39
fix: handle whitespace between variable and colon #101
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
Conversation
@e-cloud @davidyorr I'll let you all hash this out. I'm impartial to one solution over another, but don't want to get in the middle and ruffle any feathers. you guys choose which PR is more fitting, and I'll go with that one. |
It doesnt matter to me, theyre almost the same solution anyway. This PR is probably a bit cleaner to read because it makes use of the globals file. I did think of a few edge cases that would fail though. (in both PRs) // @page with no whitespace
@page:left { }
// variable name starting with @page and extra whitespace
@pageWidth : 1080px;
// @page as a variable name without pseudo class and extra whitespace
@page : 1080px; I came up with a fix for those cases but im not sure the best way to add on to this PR. |
@davidyorr After a small altering, the second case is handled now. The first will be also parsed as non-variable, but will not be parsed as atrule. That's a deeper problem inside postcss. The third problem is unresolvable via simple approach. Those ambigious variables should seldom exist. |
@shellscape @davidyorr any further reaction? |
I leave it to you two to reach a consensus. I'll merge whichever you both agree on. |
the new i think you might've meant |
@davidyorr you're right, my mistake. |
the variable declaration in less is somehow similar to at rule in css, makes its detection more complicated.
/cc @e-cloud @davidyorr what is status, we need this fix for prettier, thanks! |
@shellscape i think this PR should be good to merge |
@shellscape could you have a look and perhaps make a new release? |
@e-cloud @davidyorr @evilebottnawi will this be a breaking change for users reliant upon the previous processing patterns before the fix is applied? Need to know for the release process. |
@shellscape it is bug fix, because by Less spec allor to using whitespace before |
the variable declaration in less is somehow similar to at rule in css, makes its detection more complicated.
fix #92 , similar PR as #100. But this might be more generic.
Please check one:
This PR: