LESS add class with pseudo selector

You can use the extend option like below. It basically applies all properties of the arrow class to the button class also. The all keyword means the child classes are also extended.

LESS:

.button{
    background: blue;
    &:extend(.arrow all);
    &:before{
        border: 1px solid;
    }
}

Compiled CSS:

.arrow,
.button {
    color: red;
}
.arrow:before,
.button:before {
    content: ">";
}

I think the Extend feature ought to do the trick:

.button { 
    &:extend(.arrow all);

    background: blue;
    &:before {
        border: 1px solid;
    }
}

See http://lesscss.org/features/#extend-feature

Tags:

Css

Less