【发布时间】: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**
【问题讨论】:
-
您可能想查看此链接。 github.com/angular/angular-cli/issues/5213
标签: css angular image angular-cli