angularjs – 使用Angular CLI的Web应用程序不显示bootstrap-sass glyphicons

前端之家收集整理的这篇文章主要介绍了angularjs – 使用Angular CLI的Web应用程序不显示bootstrap-sass glyphicons前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个用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";

运行serve或ng build时没有错误,并且应用程序正常运行且浏览器控制台中没有错误.但是,图标仍然不显示.我最初运行这个应用程序正确显示glyphicons,然后我将核心应用程序代码迁移到一个新的angular-cli应用程序.有什么我想念的吗?

解决方法

这似乎是webpack在angular-cli中为 configured的方式的问题.目前,您可以通过在scss文件中使用以下内容指向引导CDN字体来解决此问题

$bootstrap-sass-asset-helper: false;
$icon-font-path: "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/";

猜你在找的Angularjs相关文章