Reputation: 22683
I'm trying to achieve something like this in LESS:
.a {
// some properties
}
.b {
.a {
.a();
}
}
It doesn't work, because it takes the .a()
from the closest scope, which is .b .a
in this case. I need this quirky rule just to overwrite another context for .a
to use the default .a
styles.
Can I call a mixin of the same selector in LESS? Or maybe there are some workarounds?
Upvotes: 0
Views: 33
Reputation: 14123
Use a separate mixin class and refer to it in both non-inside-b and inside-b cases.
To prevent outputting the mixin class, use the functional mixin-definition syntax:
.a() {}
Also, mixins can be defined inside a dummy id as a namespace, and that mixins shouldn’t be output too.
Upvotes: 2