-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Variable selector "string" improperly parses comma #1421
Comments
There are several issues raised all around the fact less does not parse |
I would like to see this issue addressed as well. It would be nice to be able to define a set of selectors and refer to them in various places throughout my LESS files via a variable name. |
@pavlovich While I would still like to see the capabilities noted in my original issue, there is a work around to get the functionality of assigning properties to a set of selectors defined in a variable using the capabilities of LESS 1.7. Consider this:
Which outputs:
So I can assign a pseudo class if I want or not, and pass a set of properties as needed. The key is to put the mixin |
@seven-phases-max so ReadyForImplementation means this is coming, but Low Priority means don't hold your breath. Any idea if this will happen in the near future? |
|
Something to think about: |
I think all that's needed here is for Less to treat comma-separated lists equally. A variable that holds a list should be expanded with |
Elevating priority because of #2964. |
I have a work-in-progress here: https://github.com/matthew-dean/less.js/tree/bugfix-1241 but the parsing is way more complicated than I thought when I started. Basically, the normal evaluation pattern of Less is stuff gets evaluated and then returns an evaluated copy of itself. In this case, the variable reference is added as an
Never mind, got it to work! ^_^ |
Revert "Fixes #1421 - re-parses variable-interpolated elements to selectors"
This StackOverflow question lead me to test what I thought would work, but failed. Namely, this example:
Did not produce what was expected, as it failed to recognize the commas as separators of individual selectors. So instead of this expected output:
It produced this unexpected output of just adding the
:focus
on the end of the whole variable value:If the variable interpretation for selectors uses the same algorithm as when a variable is in a string, I can see "why" it is doing it that way, but it would seem to me that, at least for the case of the
,
in CSS, the variable interpretation needs to recognize it is dealing with a selector at that point, and should then take the next step and parse each of the commas to separate selectors, so that all nested uses of&
will attach to all the appropriate selector strings.The text was updated successfully, but these errors were encountered: