1

我喜欢在我的 css 中使用 BEM,并且我喜欢通过extend()LESS 的功能应用修饰符。

前任:

.btn{
  width: 100px;
  &--blue:extend(.btn){
    color: blue;
  }
}

第一个问题:为什么我不能用这样的快捷方式写它&

.btn{
  width: 100px;
  &--blue:extend(&){
    color: blue;
  }
}

第二个问题:如何在其他较少的文件中调用生成的类名,例如:

.btn{
  width: 100px;
  &--blue:extend(.btn){
    color: blue;
  }
}

////

.myCustomButton{
  .btn--blue;
}

谢谢。

4

0 回答 0