The all option will add a new selector to all hierarchical relationships / nested selectors that already exist .
So, in the .parent .child nested selector, when extending .parent with .newParent it will extend the nested selector with .newParent .child because this relationship with .child defined. When extending .child with .newChild nested selector expands to .parent .newChild , as there is a relationship between .child and .parent . And you get this CSS :
.parent .child, .newParent .child, .parent .newChild { color: white; }
Note. This does not create selectors based on nested selectors created with the extension. Before the extension, there is no .newParent .child , not one of the .parent .newChild , which can lead to the creation of .newParent .newChild after the rule extension.
I'm not quite sure how accurately you want your CSS output to look, but you can always expand the "relationship" / combined / nested selector and avoid the all option so that you don't generate all hybrid selectors (like .parent .newChild and .newParent child ):
.newParent { &:extend(.parent); } .newChild { &:extend(.child); } .newParent .newChild { &:extend(.parent .child); }
or nested form:
.newChild { &:extend(.child); } .newParent { &:extend(.parent); .newChild { &:extend(.parent .child); } }
and CSS output:
.parent, .newParent { color: blue; } .child, .newChild { color: red; } .parent .child, .newParent .newChild { color: white; }
If you wish, you can simply add all the nested combinations of selectors by adding the all parameter. This will give you all the permutations of the selectors and copy this CSS :
.parent, .newParent { color: blue; } .child, .newChild { color: red; } .parent .child, .parent .newChild, .newParent .child, .newParent .newChild { color: white; }