[英]How do I add more icons to my project using FontAwesome?
I'm using font-awesome in angular 10 and I've got it to work but I'd like to use some icons that I can find on https://fontawesome.com/icons but it seems like a lot of them don't work in my project.我在 angular 10 中使用 font-awesome 并且我已经让它工作了,但我想使用一些我可以在https://fontawesome.com/icons 上找到的图标,但似乎很多图标都没有在我的项目中不起作用。 I checked font-awesome.css and it doesn't have the same icons as on website.
我检查了 font-awesome.css 并且它没有与网站上相同的图标。 Is there a way to add icon I need from the site to my project?
有没有办法将我需要的图标从站点添加到我的项目中?
Check your Font Awesome version.检查您的 Font Awesome 版本。 You should search for icons only in this specific version.
您应该仅在此特定版本中搜索图标。 If you want to use some icons of another version, remove it and add the new one.
如果您想使用其他版本的某些图标,请将其删除并添加新的。
There's also a chance you are trying to use some Pro version icons.您也有可能尝试使用某些专业版图标。 If you want to use them, you should pay for a Font Awesome Pro subscription.
如果您想使用它们,您应该支付 Font Awesome Pro 订阅费用。
If this doesn't help, please provide us with the code of the fontawesome installation along with some html of the icons you are trying to use.如果这没有帮助,请向我们提供 fontawesome 安装的代码以及您尝试使用的图标的一些 html。
尝试从官方网站将真棒字体下载到您的本地计算机,这对我有用。
I have found what was the problem, I didn't have all of the icons because I was using outdated package:我发现了问题所在,我没有所有的图标,因为我使用的是过时的包:
npm install font-awesome
The newest one(i think) is the one below and it contains icons from fontawesome 5+:最新的(我认为)是下面的,它包含来自 fontawesome 5+ 的图标:
npm install --save @fortawesome/fontawesome-free
after installation i had to add in angular cli styles:安装后,我必须添加 angular cli 样式:
"./node_modules/@fortawesome/fontawesome-free/css/fontawesome.css",
"./node_modules/@fortawesome/fontawesome-free/css/solid.css",
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.