无法自定义 Bootstrap 4 个(测试版)变量

Cannot Customize Bootstrap 4 (Beta) Variables

我是这样导入的 style.css:

<link rel="stylesheet" type="text/css" href="/css/style.css?modified=1507947241"/>

style.scss 的顶部,我有一些非 Bootstrap 代码和以下代码:

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

我将 node-sass 与 --output compressed 一起使用。它压缩 bootstrap 和我的自定义 CSS 就好了。但是,我根本无法成功覆盖 any bootstrap 变量。我想将主蓝色更改为深蓝色:

$theme-colors: (
  primary: #003366,
)

并且此声明的任何变体都无法做到这一点。我试过导入自定义 _variables.scss,我试过在其他行之前、之后、中间声明任何内容。我已经尝试了 !important 以及我在 Stack Overflow 上可以找到的所有内容。 :}

Bootstrap 4 Beta 2 解决了这个问题。 Read more here. 只需升级并开始自定义即可。

We’ve improved the ability to customize Sass maps. With Beta 1, we didn’t have a setup in place to modify your $theme-colors map without replacing it wholesale. That’s been fixed in Beta 2—override existing values and add more as needed.