LESS - Parental Control Selector
The & operator represents the parent selectors of a nested rule and is most often used when applying a modifying class or pseudo-class to an existing selector.
Since & represents the parent, you can simply use & + & :
.menu-link { & + & { border-left: 1px solid
.. which compiles to:
.menu-link + .menu-link { border-left: 1px solid #000; }
As a side note, & refers to the entire parent selector. Thus, if you should use the following:
.parent { .menu-link { & + & { border-left: 1px solid
.. he would compile the unwanted result:
.parent .menu-link + .parent .menu-link { border-left: 1px solid #000; }
So you just need to hold your selectors and use
.menu-link { & + & { border-left: 1px solid
Josh crozier
source share