新手问题 在项目中用到了 Bootstrap 3,但 Glyphicon 无法正常被显示

n00b1 · 2014年10月09日 · 最后由 bluesky0318 回复于 2015年03月20日 · 3139 次阅读

我是这样在项目中安装 bootstrap 3 的

  • Gemfile # Gemfile gem 'less-rails' gem 'twitter-bootstrap-rails' gem 'therubyracer', '~> 0.10.2'
  1. bundle
  2. rails g bootstrap:install
  3. rails g bootstrap:layout application fixed

随后就开始写页面了,其他都好,就是 glyphicon 无法显示,譬如<span class="glyphicon glyphicon-chevron-left"></span>,不知道哪里出了问题,还望得到指点

application.scss 文件里加上 @import "bootstrap";

#1 楼 @dingjop 添加了这句后,直接报错了,File to import not found or unreadable: bootstrap.

#3 楼 @xdushepherd 重启了 webrick 还是不行,同样的报错

说错了,我用的 gem 和你的不一样,看下这个 https://github.com/seyhunak/twitter-bootstrap-rails#icons

If you would like to restore the default Glyphicons, inside the bootstrap_and_overrides.css.less remove the FontAwesome declaration and uncomment the line:

用 fontawesome 吧

#7 楼 @Rei 请问瞎 Rei,这两个 gem 有什么不同呢?一个是用 less,一个是用 sass?

#8 楼 @n00b1 一个是个人维护,一个是官方维护。官方的出了之后,基本上都转用官方的了,用个人的 gem 别人不一定懂得处理问题。

#9 楼 @Rei x 谢谢 Rei 的解释

#10 楼 @n00b1 你用 rei 的方法搞定冒?

需要 登录 后方可回复, 如果你还没有账号请 注册新账号