less を使用して、クラス内の特定の要素をターゲットにしたいと考えています。
この場合、 class の要素をターゲットにしbutton
たいのですが、その中でアンカータグをターゲットにしたいと思いa
ます。
現在私は持っています:
.button {
/* lots of bits and pieces go here, hence
the need to keep it at a class level
*/
/* further down, but still in .button */
/* Attempt 1 - fails: compiled = a .button (note the space)
a& {
height:20px;
}
/* Attempt 2 - fails: compiled = .buttona
&a {
height:20px;
}
}
私は基本的にそれを次のようにコンパイルしたい:
a.button
これは、次のような要素を作成できるようにするためです。
<a class="button">
<button class="button">
ただし、アンカーの場合は少し変更します。it's a bug in less!
あまりにも早くカードを投入したくありませんが、使用&.another-class
すると期待どおりに動作します (コンパイル済み:.button.another-class
ですが、要素をターゲットにする場合はそうではありません