font-awesome字体未加载到angular项目中 [英] font-awesome fonts are not loaded into angular project
问题描述
我已经使用角度5了一段时间了,看来我无法将任何超棒的字体图标加载到构建的项目中.
I've been using angular 5 for a while now and it seems that I can't load any font-awesome icons into my built project.
我完全按照下面的链接中所述的步骤进行操作. https://www.npmjs.com/package/angular-font-awesome
I followed the steps thoroughly as mentioned in the link below. https://www.npmjs.com/package/angular-font-awesome
项目中似乎包含了CSS文件,但是当我在浏览器开发人员工具的网络"部分中选中时,它无法加载字体.
It appears that the CSS file is included in the project but it's not able to load the fonts as I checked in the network section of my browser's developer tools.
我在呈现的页面中看到的只是正方形图标,而不是超棒的字体图标.
All I'm seeing in the rendered page is square icons instead of font-awesome icons.
如果有人可以帮助我,我将非常感谢.
I would really appreciate it if anyone can help me with this.
推荐答案
使用
$ npm i font-awesome
打开您的angular-cli.json
文件,搜索属性styles
和assets
,并将其添加到其中:
Open your angular-cli.json
file, search for the properties styles
and assets
, add this in it :
// styles
"../node_modules/font-awesome/css/font-awesome.css"
// assets
"../node_modules/font-awesome/fonts"
(您当然可以复制字体并将其放入您自己的文件夹中).
(You can of course copy the fonts and put them into your own folder).
这篇关于font-awesome字体未加载到angular项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!