擴充套件巢狀選擇器
你還可以擴充套件巢狀選擇器。以下少
.otherChild{
  color: blue;
}
.otherParent{
  color: red;
  .otherChild{
    font-size: 12px;
    color: green;
  }
}
.parent{
  .nestedParagraph{
    &:extend(.otherParent .otherChild);
  }
}
將編譯為
.otherChild {
  color: blue;
}
.otherParent {
  color: red;
}
.otherParent .otherChild,
.parent .nestedParagraph {
  font-size: 12px;
  color: green;
}
用以下 html
<div class="otherParent">
  Other Parent Words
  <div class="otherChild">
    Other Nested Words
  </div>
</div>
<div class="parent">
  Parent Words
  <div class="nestedParagraph">
    Nested Words
  </div>
</div>
結果是

巢狀段落的字型顏色是綠色,而不是藍色! 這表明我們可以擴充套件巢狀選擇器!