-
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
Multiple use of unlocking mixin within the same scope #1291
Comments
If I recall correctly, it was requested that Less mixins not produce duplicate properties, so I think this was intentional, e.g. a feature. I think properties are merged with the last properties "winning". @lukeapage am I correct? |
I tried to simplify the example in description as much as possible, but cause slightly more complicated case uses different properties:
produces:
but should produce (I think):
|
Btw., (what we've learned in #1678): in examples above the first Example (adopted from #1678):
result:
|
I think that parameter/variable value should be lock at the time mixin was "unlocked". Variables are usually solved from local scope including parent scopes. Search only then continues to caller. If we would take your explanation, then this:
would have to compile into this:
However, it compiles into this:
Mixins unlocking would be less useful then. At least I think, I do not know how many people are using that. |
Mixins that are not unlocked work the same way. Variables are solved first and declarations are copied only after that:
compiles into:
and this
compiles into:
|
Sorry, probably my explanation was not clear enough. I only unfolded what happens there, I did not mean that this is expected behaviour. Notice how in my example the call to the second
In other words the issue seems to be not in "first mixin is not unlocked" but in "last unlocking overwrittes internal state of all previously unlocked mixins". |
@seven-phases-max Sorry back, I misunderstood you. |
This issue seems to be fixed in the current master (i.e. pre-1.7.0)... Cool, now my OOP example works as expected:
result:
👯 |
Closing as fixed in 1.7.0. |
This is about "unlocking mixins" feature #73. I'm not sure whether this is a feature or a bug, but I'm guessing a bug.
If the same mixin is called twice, only mixins from the second call are imported. First import mixins are ignored.
This:
Actual result:
Expected result:
It does not seem to be terribly important, I mostly need to know whether it works as intended or not.
The text was updated successfully, but these errors were encountered: