Rails、Compass 和 Bootstrap:未显示字形,但字体似乎是

Rails, Compass, and Bootstrap: Glyphicons not showing, though font seems to be

是的,这是一个总是重复出现的问题,但我想不通。

我正在使用 rails (4.2.)、compass-rails (2.0.5) 和 bootstrap-sass (3.3.5),以及我的字形没有显示。

参见 http://base.sirius.uberspace.de/en,"Number of users" 旁边的图标显示为小方框,但它是 glyphicon-user 图标。

据我所知,字体似乎已正确加载到 application.css 文件中:

@at-root{@font-face{font-family:'Glyphicons Halflings';src:url("/assets/bootstrap/glyphicons-halflings-regular.eot");src:url("/assets/bootstrap/glyphicons-halflings-regular.eot?#iefix") format("embedded-opentype"),url("/assets/bootstrap/glyphicons-halflings-regular.woff2") format("woff2"),url("/assets/bootstrap/glyphicons-halflings-regular.woff") format("woff"),url("/assets/bootstrap/glyphicons-halflings-regular.ttf") format("truetype"),url("/assets/bootstrap/glyphicons-halflings-regular.svg#glyphicons_halflingsregular") format("svg")}}

当我请求这些 src: url(...) 中的任何一个 URL 时,它们都会正确响应并且我可以下载字体。所以字体似乎是可用的,但是当使用 .glyphicon-xxx CSS class 时,它显示不正确。

知道问题出在哪里吗?我很乐意提供更多详细信息,但由于字体似乎可以正常使用,我认为问题出在可以使用网站进行调试的某个级别,但我只是不知道该怎么做。

我将我的宝石更新为 bootstrap-sass (3.3.6)、指南针-rails (3.0.0) 和 rails (4.2.5.1 ).这解决了问题。

对于任何感兴趣的人,这仍然是必需的:

$icon-font-path: '/assets/bootstrap/' // Otherwise the fonts are searched in the wrong place, see https://gist.github.com/iamatypeofwalrus/6467148