是的,这是一个经常出现的,但我无法弄明白。
我正在使用rails(4.2。),compass-rails(2.0.5)和bootstrap-sass(3.3.5),我的字形没有显示。
请参阅http://base.sirius.uberspace.de/en,其中“用户数量”旁边的图标显示为小方框,但它是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(...)
个网址时,他们会正确回复,我可以下载该字体。因此字体似乎可用,但在使用.glyphicon-xxx
CSS类时它无法正确显示。
知道问题是什么?我很乐意提供更多详细信息,但由于字体似乎可以正常使用,我认为问题是在可以使用网站调试的某个级别,但我根本不知道该怎么做。
答案 0 :(得分:0)
我将我的宝石更新为bootstrap-sass(3.3.6),compass-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