【问题标题】:"Can't resolve '..node_modules/font-awesome/fonts/fontawesome-webfont.eot' "and other font awesome files“无法解析'..node_modules/font-awesome/fonts/fontawesome-webfont.eot'”和其他字体很棒的文件
【发布时间】:2021-01-17 02:33:07
【问题描述】:

我一直在想办法解决这个问题。有人可以帮忙吗?

问题:我想在我的应用程序中使用 font awesome,我通过 Angular-CLI 安装了它

并将其包含在 styles.scss 中

$fa-font-path: "../node_modules/font-awesome/fonts"; @import "../node_modules/font-awesome/scss/font-awesome";

webpack 版本:4.44.2

错误:

【问题讨论】:

    标签: angular sass angular-cli


    【解决方案1】:

    如果你用 cli 安装了 font awesome 到项目,你不需要把它放在 styles.scss 中,只需要放在 angular.json 样式属性中

     "node_modules/font-awesome/css/font-awesome.min.css",
    

    或者你可以通过添加Demo来使用它

    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css" rel="stylesheet"/>
    

    在 index.html 中不使用库

    【讨论】:

    • 嘿,谢谢!我尝试了你的两个建议,虽然是的,第二个效果很好。第一个没有工作..没有构建错误,但没有显示图标。我想使用图书馆。
    • 你想要哪些图标?
    猜你喜欢
    • 2015-10-18
    • 2016-12-26
    • 2013-03-01
    • 2023-01-07
    • 1970-01-01
    • 2017-04-02
    • 2013-11-02
    • 2016-01-10
    • 2017-10-13
    相关资源
    最近更新 更多