I was wondering how I could do something like the following with less css:
.btn {
color : black;
}
.btn:hover {
color : white;
}
.btn-foo {
.btn;
&:hover {
.btn:hover;
}
}
Of-course this is just an example, what need to point is if there is any way to extend the pseudo-class in order to avoid re-type the properties of :hover
pseudo class everywhere I need them. I know I could create a mixin for that but I'm wondering if I could avoid it.
Thanks
UPDATE: If you can't modify external files just redefine the selectors, and add missing states:
Better now? :)
You don't need pseudo class. It will just work :)
Try this:
Each
<button class='btn'>
element you create will inherit whatever was defined, including hover state. I think it's one of the main amazing features of LESS.Hope this helps.
In Less 1.4.0(1.4.1?)
This:
Expands to this:
Be cautious though, this:
Will output this:
I have not looked into SASS more than half an hour, but I believe the later case is its default (or only) @extend behavior.