次のような Less mixin があります: 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) {}
}
パラメーター内を親セレクターに展開できるように表記を変更することが可能かどうか疑問に思ってい&
ます。それは、変数の外に書き込む場合です。
Codepen の CSS セクションで [View Compiled] をクリックすると、次の&
ように直接出力されていることがわかります。
#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)&
(スペースとアンパサンド)。