我有一个使用Angular CLI创建的应用程序,并且我正在使用bootstrap-sass
自定义主题。我正在使用以下版本...
node: 6.9.5
os: win32 x64
@angular/common: 2.4.8
@angular/cli: 1.0.0-rc.0
@angular/compiler-cli: 2.4.8
bootstrap-sass: 3.3.7
在我的.angular-cli.json
中,我有
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/bootstrap-sass/assets/javascripts/bootstrap.min.js"
]
在我的html
文件中我有
<span class="glyphicon glyphicon-user"></span>
在我的scss
文件中我有
$bootstrap-sass-asset-helper: true;
$icon-font-path: if($bootstrap-sass-asset-helper, "../bootstrap/", "../fonts/bootstrap/");
@import "../node_modules/bootstrap-sass/assets/stylesheets/_bootstrap.scss";
我运行ng serve
或ng build
时没有错误,并且该应用程序正确运行,而浏览器控制台中没有任何错误。但是,图标仍然不显示。我最初将此应用程序运行,该应用程序与标语正确显示,然后将Core Application代码迁移到新的angular-cli
应用程序中。我缺少什么吗?
这似乎是webpack
在angular-cli
中配置的方式的问题。目前,您可以通过指向bootstrap cdn字体,并在 scss
文件中使用以下内容解决此问题
$bootstrap-sass-asset-helper: false;
$icon-font-path: "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/";