bootsrtap定制不能在angular 7中使用吗?

时间:2019-01-10 08:53:51

标签: angular bootstrap-4

我正在尝试在角度7中自定义bootstrap 4主题,

我已经安装了引导程序,

在我有角的.json中

 "styles": [
                "./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css",
                "./node_modules/bootstrap/dist/css/bootstrap.min.css",
                "src/styles.scss"
            ],

style.scss是我自定义的scss类,

inside style.scss

尝试更改警告主题的颜色

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

   $theme-colors: ( "warning": #0074d9, "danger": #ff4136 );

我有一个带有btn-warning类的按钮,我试图更改btn-warning颜色。但不起作用

style.scss在我的视图中呈现,但是按钮的颜色没有改变。

我做错了什么?

2 个答案:

答案 0 :(得分:0)

在样式数组中,您将导入bootstrap.min.css,在style.scss中,您将导入bootstrap.scss。为什么要导入这两个不同的CSS文件?这两个文件将互相覆盖。

答案 1 :(得分:0)

我尝试按照我的style.scss向下移动bootstrap.scss的导入,例如:

$theme-colors: ( "warning": yellow, "danger": #ff4136, "customcolor": red);

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

它奏效了。