我有一个像这样的 Less 混合:http ://codepen.io/sirlancelot/pen/QjzzEb?editors=110
// The mixin to toggle containers
#toggle-container(
@collapsed-selector: ~"&.__collapsible .section--body",
@expanded-selector: ~"&.__open .section--body"
) {
@{collapsed-selector}:extend(#section--collapsed) {}
@{expanded-selector}:extend(#section--expanded) {}
}
我想知道是否可以更改符号,以便&
可以将参数中的 in 扩展到父选择器,就像我将它写在变量之外一样。
如果您单击 Codepen 的 CSS 部分中的“查看已编译”,您将看到&
直接输出如下:
#section--collapsed,
.section &.__collapsible .section--body {
transition: transform ease 250ms;
transform: scaleY(0);
transform-origin: top;
position: absolute;
width: 100%;
z-index: 1;
}
#section--expanded,
.section &.__open .section--body {
transform: scaleY(1);
position: static;
}
我希望(space)&
删除(空格和&符号)。