如何将范围限定为 class 而不是样式

How to scope to a class instead of a style

有没有办法缩短下面的代码?

.outer-a {
    .inner {
        background-color: white;
    }
}

.outer-b {
    .inner {
        background-color: white;
    }
}

我的预期输出:

.outer-a .inner {
    background-color: white;
}

.outer-b .inner {
    background-color: white;
}

我在 Less 文档中找不到提供此功能的任何功能。

你可以像

这样的家长
.outer-a,
.outer-b {
    .inner {
        background-color: white;
    }
}

我猜你可以试试逗号。像这样:

.outer-a, .outer-b {
    .inner {
        background-color: white;
    }
}

然后编译成这个

.outer-a .inner,
.outer-b .inner {
  background-color: white;
}