Obr*_*ios 3 twitter-bootstrap bootstrap-sass ruby-on-rails-4
根据这篇文章有一些问题,一些glyphicons不工作,但问题是在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>
Run Code Online (Sandbox Code Playgroud)
这些都行不通
<span class="glyphicon glyphicon-thumbs-up" aria-hidden="true"></span>
<span class="glyphicon glyphicon-heart" aria-hidden="true"></span>
Run Code Online (Sandbox Code Playgroud)
在我的application.css.scss文件中,我在bootstrap之前加载bootstrap-sprockets,即
@import "bootstrap-sprockets";
@import "bootstrap";
Run Code Online (Sandbox Code Playgroud)
我使用rails 4.2.2,sass-rails', '~> 4.0.4','sprockets-rails', '>=2.1.4'.为什么这不起作用?
以下是检查元素chrome web工具时资产的相关摘录:
/* 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";
}
Run Code Online (Sandbox Code Playgroud)
我成功地包括了glyphicons.在包含引导程序后添加以下font-face.
@import 'bootstrap-sprockets';
@import 'bootstrap';
@font-face{
font-family:'Glyphicons Halflings';
src: image-url("bootstrap/glyphicons-halflings-regular.eot");
src: image-url("bootstrap/glyphicons-halflings-regular.eot?#iefix") format("embedded-opentype"),
image-url("bootstrap/glyphicons-halflings-regular.woff") format("woff"),
image-url("bootstrap/glyphicons-halflings-regular.ttf") format("truetype"),
image-url("bootstrap/glyphicons-halflings-regular.svg#glyphicons_halflingsregular") format("svg")
}
Run Code Online (Sandbox Code Playgroud)
参考:http: //doruby.kbmj.com/taka/20140726/_Rails4_Bootstrap_assets_precompile_glyphicon_
| 归档时间: |
|
| 查看次数: |
3447 次 |
| 最近记录: |