Ruby on Rails Bootstrap Glyphicons 不起作用 [英] Ruby on Rails Bootstrap Glyphicons not working
问题描述
我已将引导程序添加到我的网站.这是我正在使用的结构.(我无法删除 bootstrap.css 文件,因为我根据自己的喜好对其进行了修改).
I have added bootstrap to my site. Here is the structure I am using. (I cannot whatsoever remove the bootstrap.css file since it I modified it to my liking).
>app
>>assets
>>>fonts
>>>>4 glypicons icon files.
>>>images
>>>>N/A
>>>javascripts
>>>>Bootstrap.js (Jquery is installed in a gem)
>>>stylesheets
>>>>Bootstrap.css
一切都已正确导入,但问题是字形无法正常工作,我需要它们!
Everything is imported correctly, but the issue is that the glyphicons arent working and I need them!
推荐答案
November 2015 我会推荐这个 gem:https://github.com/twbs/bootstrap-sass 它由 Bootstrap 社区积极维护,并且与 Ruby on Rails 配合得非常好.
November 2015 I would recommend this gem: https://github.com/twbs/bootstrap-sass It is actively maintained by the Bootstrap community and works really well with Ruby on Rails.
我遇到了和你非常相似的问题,但我想通了!在 bootstrap.css 文件中找到这部分:
I was having a very similar issue as you but I figure it out! Find this part in your bootstrap.css file:
@font-face {
font-family: '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.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}
并将 ../fonts/
替换为 /assets
.这就是您的最终代码的样子.
and replace ../fonts/
with /assets
. This is what your final code will look like.
@font-face {
font-family: 'Glyphicons Halflings';
src: url('/assets/glyphicons-halflings-regular.eot');
src: url('/assets/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('/assets/glyphicons-halflings-regular.woff') format('woff'), url('/assets/glyphicons-halflings-regular.ttf') format('truetype'), url('/assets/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}
我希望这有帮助!
这篇关于Ruby on Rails Bootstrap Glyphicons 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!