简体   繁体   English

覆盖引导程序变量angular-cli

[英]override bootstrap variables angular-cli

I have an angular-cli project which I have added bootstrap-sass package. 我有一个我添加了bootstrap-sass包的angular-cli项目。 I have loaded the styles in angular-cli.json by adding this: 我通过添加以下代码将样式加载到angular-cli.json中:

"styles": [
        "../node_modules/bootstrap-sass/assets/stylesheets/_bootstrap.scss",
        "../node_modules/font-awesome/css/font-awesome.css",
        "styles.scss"
      ]

But I want to be able to override some of the variables that bootstrap has. 但是我希望能够覆盖引导程序具有的一些变量。 How can I do this in a angular-cli project? 如何在angular-cli项目中做到这一点?

This was actually rather easy. 这实际上很容易。 If anyone has the same problem what I did was to include the following as global styles instead of loading styles via angular-cli.json: 如果有人遇到相同的问题,我所做的就是将以下内容包括为全局样式,而不是通过angular-cli.json加载样式:

$icon-font-path: '~bootstrap-sass/assets/fonts/bootstrap/';
@import './shared/styles/_variables'; // my custom vars that overrides bootstrap
@import '~bootstrap-sass/assets/stylesheets/bootstrap';

如果您以以下方式将bootstrap.scss导入到主style.scss文件中,则该方法应该起作用。

@import '<RALATIVE_PATH_TO>node_modules/bootstrap/scss/bootstrap.scss';

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

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