【问题标题】:Font url not working in angular 5 css reference字体 url 在 angular 5 css 参考中不起作用
【发布时间】:2018-08-08 07:04:24
【问题描述】:

我用 angular cli 创建了一个 angular 5 项目。在 angular-cli.json 样式标签中引用了 css。

"styles": [
        "styles.css",
        "static/css/custom.css",
        "static/css/style.bundle.css",
        "static/css/vendors.bundle.css",
        "static/css/fullcalendar.bundle.css"
      ]

当我尝试在浏览器中运行应用程序时。我在控制台中收到字体文件中止错误

GET http://localhost:4200/fonts/font-awesome/fontawesome-webfont.woff2?v=4.7.0 net::ERR_ABORTED
fonts/font-awesome/fontawesome-webfont.woff?v=4.7.0:1 GET http://localhost:4200/fonts/font-awesome/fontawesome-webfont.woff?v=4.7.0 net::ERR_ABORTED
fonts/font-awesome/fontawesome-webfont.ttf?v=4.7.0:1 GET http://localhost:4200/fonts/font-awesome/fontawesome-webfont.ttf?v=4.7.0 net::ERR_ABORTED

这些字体文件正在vendors.bundle.css中使用

我尝试了什么:

  • 我尝试将 css 文件中的 url src: url("fonts/socicon/socicon.eot") 更改为 src: url("/fonts/socicon/socicon.eot")
  • 我试着像这样加载css,

    <link rel="stylesheet" type="text/css" ref="./static/css/style.bundle.css"/>

但它给了我这个错误

**because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled**

【问题讨论】:

标签: css angular image angular-cli


【解决方案1】:

Angular 2: file not found on local .json file

似乎“静态”文件夹无法访问。上一期可能会有所帮助。

【讨论】:

    猜你喜欢
    • 2019-03-28
    • 1970-01-01
    • 1970-01-01
    • 2022-12-11
    • 2018-09-25
    • 1970-01-01
    • 2013-02-25
    • 2019-01-12
    • 1970-01-01
    相关资源
    最近更新 更多