我有一个与SCSS代码相关的简单代码,其中在@media查询内部有@extend。
SCSS编译器给出了这两种变体的错误:
变体1:
%dark-theme {
background: $dark-background;
}
%light-theme {
background: $light-background;
}
@media (prefers-color-scheme: light) {
body {
@extend %light-theme;
}
}
@media (prefers-color-scheme: dark) {
body {
@extend %dark-theme;
}
}
变体2
%dark-theme {
background: $dark-background;
}
%light-theme {
background: $light-background;
}
@media (prefers-color-scheme: light) {
@extend %light-theme;
}
@media (prefers-color-scheme: dark) {
@extend %dark-theme;
}
有没有办法在基本元素和媒体查询中使用@extend的解决方法?