【发布时间】:2020-04-27 23:40:57
【问题描述】:
使用 Bootstrap 4,我正在尝试在 mixin 中更改 brand-primary 的值:
// variables
$theme-colors: (
"main": #9fa28b,
"another-section": #ec008c,
"yet-another-section": #00b0d8
);
// main scss
@mixin theme($color){
$theme-colors: (
"brand-primary": $color
);
}
body {
@include theme(theme-color($key: "main"));
&.another-section {
@include theme(theme-color($key: "another-section"));
}
&.yet-another-section {
@include theme(theme-color($key: "yet-another-section"));
}
}
这编译没有错误,但类another-section或yet-another-section在编译的css中没有任何内容。
有没有办法在 mixin(或任何变量)中覆盖 brand-primary?
【问题讨论】:
-
您尝试修改哪个版本的 Bootstrap? Bootstrap 4 中没有
brand-primary变量?只是primary?
标签: css sass bootstrap-4 scss-mixins