css - 在 mixin 中修改 Bootstrap 变量
问题描述
使用 Bootstrap 4,我正在尝试更改brand-primary
mixin 中的值:
// 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 中。
有没有办法brand-primary
在 mixin(或任何变量)中覆盖?
解决方案
如果我理解你是正确的,你想改变颜色。您所要做的就是覆盖原色检查此链接如何更改引导程序原色?
推荐阅读
- sql-server - 从 mssql 表插入触发器触发 nodejs 函数
- templates - 搜索标签页面上的较早帖子问题
- r - 在 R 中使用 :: 使用管道运算符“%>%”
- image - 检索给定分辨率和中心点的图像的角坐标
- python - 从具有特定 len 的文件单词中提取
- django - Google App Engine 为 ... 记录了一堆新连接,并且客户端关闭了本地连接
- azure - 将文件夹从本地计算机传输到 Azure VM
- javascript - 未捕获:类型错误
- ember.js - Ember:离开路线时自动销毁未提交的新模型实例
- ruby-on-rails - 我在哪里可以更改我的 Ruby gems 目录路径