0

For example:

.icon-pinterest{
    color:#CC2027;
    background: #fff;
    &:hover{
        color:#CC2027;
        background: #fff;
    }
}

This will generate:

.icon-pinterest {
  color: #cc2027;
  background: #fff;
}

.icon-pinterest:hover {
  color: #cc2027;
  background: #fff;
}

But I want it as the following:

.icon-pinterest,
.icon-pinterest:hover {
  color: #cc2027;
  background: #fff;
}

I think maybe I can use the extend expression?

JJJ
  • 32,902
  • 20
  • 89
  • 102
Terry
  • 127
  • 1
  • 11

2 Answers2

6

This is not possible, as it does not seem all that sensible in the first place (applying a hover for example to an element where the default style is already the same) and is still possible with the default CSS syntax for those rare cases where you need it. So you would simply use

.icon-pinterest,
.icon-pinterest:hover {
  color: #cc2027;
  background: #fff;
}
David Mulder
  • 26,123
  • 9
  • 51
  • 114
0

Just in case, it is of course possible with extend, but that would not make any sense since it's already perfect enough in its native CSS format (see @David Mulder answer). Just always remember that Less is still the CSS and never use Less nesting for the sake of nesting.

Using extend:

.icon-pinterest {
    color: #CC2027;
    background: #fff;
    &:hover:extend(.icon-pinterest) {}
}
seven-phases-max
  • 11,765
  • 1
  • 45
  • 57