【发布时间】:2015-07-17 04:15:28
【问题描述】:
根据post 的说法,某些字形图标无法正常工作,但问题已在 bootstrap-sass 中得到解决。但我正在使用 bootstrap-sass 3.3.5,有些仍然无法正常工作。例如这些工作
<span class="glyphicon glyphicon-asterisk" aria-hidden="true"></span>
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
这些都不起作用
<span class="glyphicon glyphicon-thumbs-up" aria-hidden="true"></span>
<span class="glyphicon glyphicon-heart" aria-hidden="true"></span>
在我的application.css.scss 文件中,我在引导之前加载引导链轮,即
@import "bootstrap-sprockets";
@import "bootstrap";
我正在使用rails 4.2.2、sass-rails', '~> 4.0.4'、'sprockets-rails', '>=2.1.4'。为什么这不起作用?
这是我检查元素 chrome 网络工具时资产的相关摘录:
/* line 24, /Users/Chris/.rvm/gems/ruby-2.1.6@golf_mentor/gems/bootstrap-sass-3.3.5/assets/stylesheets/bootstrap/_glyphicons.scss */
.glyphicon {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings';
font-style: normal;
font-weight: normal;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* line 37, /Users/Chris/.rvm/gems/ruby-2.1.6@golf_mentor/gems/bootstrap-sass- 3.3.5/assets/stylesheets/bootstrap/_glyphicons.scss */
.glyphicon-asterisk:before {
content: "\2a";
}
/* line 38, /Users/Chris/.rvm/gems/ruby-2.1.6@golf_mentor/gems/bootstrap-sass- 3.3.5/assets/stylesheets/bootstrap/_glyphicons.scss */
.glyphicon-plus:before {
content: "\2b";
}
【问题讨论】:
-
你能制作一个代码演示吗? Codepen 会很好用。
-
它是一个 ruby on rails 应用程序,因此很难演示该部分代码,并且尚未部署。相关的 html 是上面的四行,其中两行给出正确的符号,两行给出一个正方形。我认为我的样式不会对此产生影响,因为它似乎与上面引用的帖子完全相同。我正在使用 bootstrap-sass gem。我已经描述了 application.css.scss 文件的相关部分。你还有什么想知道的吗?
-
您是否预编译了资产?
-
我从事开发工作,没有进行预编译。不过我确实有
config.assets.debug = false。 -
它对我有用,我的 gemfile 显示
bootstrap-sass (3.3.4.1)你最近做了更新,你可能有旧的预编译引导资产?
标签: twitter-bootstrap ruby-on-rails-4 bootstrap-sass