2
我現在在Sass中的路徑/選擇器有點問題。 我得到了這樣的事情:在SASS中展開上一個路徑
&.foo {
some-stuff .class,
some-stuff ul,
other-stuff .all {
color: red;
}
}
現在,我想使顏色藍色,當第一路徑& .foo.bar例如:
&.foo {
some-stuff .class,
some-stuff ul,
other-stuff .all {
color: red;
// This obviously doesn't work, it's just here to show
// what I want to do easier
&.bar {
color: blue;
}
}
}
// Compile to
.foo some-stuff .class,
.foo some-stuff ul,
.foo other-stuff .all {
color: red;
}
.foo.bar some-stuff .class,
.foo.bar some-stuff ul,
.foo.bar other-stuff .all {
color: blue;
}
有什麼辦法來完成那?
我試圖使用變量來存儲當前選擇器與selector-parse Function,但它沒有像我想要的那樣工作。在此先感謝
您是否嘗試過'&.bar的一些-東西.class' AS內部的'&.foo'嵌套選擇? – Harry
這將工作,但我不得不重新鍵入與所有基礎選擇器的一切。我希望儘可能做到幹。更新了問題以使其更清楚。 – PreFiXAUT
工程就像一個魅力!謝謝分配! – PreFiXAUT