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