Meteor:无法解码下载的字体和OTS解析错误 - 无效的版本标记

时间:2015-12-11 21:48:30

标签: meteor twitter-bootstrap-3 fonts glyphicons

我已经开始在我的流星项目中使用glyphicons和twbs:boostrap包。自从我开始使用它们以来,我一直在控制台中收到以下警告:

Failed to decode downloaded font: http://localhost:3000/fonts/glyphicons-halflings-regular.woff2
OTS parsing error: invalid version tag
Failed to decode downloaded font: http://localhost:3000/fonts/glyphicons-halflings-regular.woff
OTS parsing error: invalid version tag
Failed to decode downloaded font: http://localhost:3000/fonts/glyphicons-halflings-regular.ttf
OTS parsing error: invalid version tag

造成这种情况的原因是什么?如何抑制这些警告或解决问题? glyphicons工作得非常好,但是一直看到警告只是一种痛苦。

3 个答案:

答案 0 :(得分:3)

这意味着您用于导入glyphicons的包中有一个错误,并且没有正确声明字体文件'位置或没有正确添加到包本身的字体文件。

检查软件包维护者问题跟踪器,同时将glyphicons下载到public目录并在您自己的CSS文件中声明它们。

答案 1 :(得分:0)

在尝试了很多其他方法,以及大量重新安装和检查meteor以及npm配置后,我刚刚通过清除Chrome中的浏览数据(缓存的图像和文件)然后刷新页面来修复此问题。

答案 2 :(得分:0)

Serkan Durusoy的上述回答对我有用,但是这里有我必须做的更多细节。

  1. 将字体文件从node_modules / bootstrap / dist / fonts复制到public / fonts

  2. 将此添加到我的main.css中:

    @ font-face {   字体家族:'Glyphicons Halflings';   src:url('fonts / glyphicons-halflings-regular.eot');   src:url('fonts / glyphicons-halflings-regular.eot?#iefix')format('embedded-opentype'),url('fonts / glyphicons-halflings-regular.woff2')format('woff2'),url ('fonts / glyphicons-halflings-regular.woff')format('woff'),url('fonts / glyphicons-halflings-regular.ttf')format('truetype'),url('fonts / glyphicons-halflings- normal.svg#glyphicons_halflingsregular')format('svg'); }

我从node_modules / bootstrap / dist / css / bootstrap.css复制了css,并更改了路径以匹配放置字体的位置。