[SEPARATE RESPONSE]
Since I was expelled without any comment or excuse, I feel obligated to respond to what, in my opinion, could be the reason for the downvote.
The & symbol has the keyword function this , in fact (a thing that I did not know at the time of writing the answer). You can write:
.class1 { &.class2 {} }
and the generated CSS will look like this:
.class.class2 {}
For the record, @grobitto was the first to publish this information.
[ORIGINAL RESPONSE]
LESS does not work this way.
.class1.class2 {} - defines two classes in one DOM node, but
.class1 { .class2 {} }
defines nested nodes. .class2 only applies if it is a child of node with class class1 .
I was also confused with this, and my conclusion is that LESS requires the keyword this :).
mingos Feb 25 '11 at 12:22 2011-02-25 12:22
source share