Less Extend 仅支持精确匹配

以下少

div.paragraph{
  color: blue;
}

*.paragraph{
  color: green;
}

.otherClass.paragraph{
  color: red;
}

.paragraph.otherClass{
  color: darkgrey;
}

.parent{
  .nestedParagraph{
    &:extend(.paragraph);
  }
}

将编译成

div.paragraph {
  color: blue;
}
*.paragraph {
  color: green;
}
.otherClass.paragraph {
  color: red;
}
.paragraph.otherClass {
  color: darkgrey;
}

使用以下 HTML

<div class="parent">
  Parent Words
  <div class="nestedParagraph">
    Nested Words
  </div>
</div>

<div class="paragraph">
  Paragraph
</div>

<ul class="paragraph">
  ul paragraph
  <li>1</li>
  <li>2</li>
</ul>

<div class="otherClass paragraph">
  Other Class Paragraph
</div>

<div class="paragraph otherClass">
  Other Class Paragraph
</div>

我们的结果是

StackOverflow 文档

我们可以看到 Less Extend 仅支持精确匹配,因为嵌套的单词没有应用样式。