我正在进行资产预编译,并在生产模式下运行该应用程序。编译后,当我加载我的索引页面时,我在chrome控制台中得到了以下警告。
Failed to decode downloaded font: http://localhost:3000/fonts/ionicons.ttf?v=2.0.0
prospects:1 OTS parsing error: invalid version tag
Failed to decode downloaded font: http://localhost:3000/fonts/ionicons.woff?v=2.0.0
prospects:1 OTS parsing error: invalid version tag
问题是它没有加载图标,而显示的是方块。
我们使用了自定义字体,代码是。
@font-face {
font-family: 'icomoon';
src: font-url('icomoon.eot');
src: font-url('icomoon.eot?#iefix') format('embedded-opentype'),
font-url('icomoon.ttf') format('truetype'),
font-url('icomoon.woff') format('woff'),
font-url('icomoon.svg#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
我不知道我的终端缺少什么。我搜索了很多,也尝试了解决方案,但没有得到任何成功。在开发模式下,它工作得很好,但不知道为什么在生产模式下会显示方块。
如果在IIS服务器和.net 4/4.5上运行,它可能在Web.config中缺少mime/文件扩展定义--像这样。
<system.webServer>
<staticContent>
<remove fileExtension=".eot" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<remove fileExtension=".ttf" />
<mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
</staticContent>
</system.webServer>