这是我最终想要做的事情:
.books, .dvds, .magazines {
article &.books {
/* Wanting the selector to only be ".books article" */
}
article {
/* Can apply to any of the `article` tags under .books, .dvds and .magazines */
}
}
我有一些嵌套的选择器,而不是打破一个新的选择.books article
器,我想让它们保持嵌套,但仍然只有.article
.books
我确实尝试过,它有效,但输出是.books.books article
,这是多余的,让我畏缩:
.books, .dvds, .magazines {
&.books article {
/* Outputs ".books.books article, .dvds.books article, .magazines.books article"...boooo, hisssss */
}
}