简体   繁体   English

Bootstrap scss 覆盖删除 $theme-colors

[英]Bootstrap scss override deletes $theme-colors

I added the last version of bootstrap to my npm project and created an stylesheet with the code below.我将最后一个版本的引导程序添加到我的 npm 项目中,并使用以下代码创建了一个样式表。 So I import the functions and the variables, then I want to override the primary theme-colors variable and then import the rest of the bootstrap, as is told in the docs .所以我导入函数和变量,然后我想覆盖primary theme-colors变量,然后导入引导程序的 rest,如文档中所述。 The problem is that when I run this code, only the primary button has it's required color, the other colors are removed.问题是,当我运行此代码时,只有主按钮具有所需的颜色,其他 colors 被删除。 If I comment the code, all colors work as expected.如果我评论代码,所有 colors 都会按预期工作。 Does anyone know what is going on?有谁知道发生了什么?

$theme-colors: (
  "primary": #D4AF37
);

@import "node_modules/bootstrap/scss/bootstrap";

Minutes after posting this question I found it myself.发布这个问题几分钟后,我自己发现了它。 The docs article I linked is for 4.0, this article is for 5.0.我链接的文档文章适用于 4.0,本文适用于 5.0。 This will work:这将起作用:

$primary: #D4AF37;

@import "node_modules/bootstrap/scss/bootstrap";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM