相关疑难解决方法(0)

Bootstrap 3 + Rails 4 - 某些Glyphicons不工作

我想在我的rails 4 app中使用bootstrap 3.按照教程使用 github页面中的bootstrap saas设置bootstrap 3 .

Bootstrap工作正常,但glyphicons没有按预期工作.

某些字形根本没有显示.例如,我厌倦了在application.html.erb中显示其中一些进行测试:

glyphicon glyphicon-floppy-disk -> <span class="glyphicon glyphicon-floppy-disk"></span>
</br>
glyphicon glyphicon-plus -> <span class="glyphicon glyphicon-plus"></span>
</br>
glyphicon glyphicon-minus -> <span class="glyphicon glyphicon-minus"></span> 
Run Code Online (Sandbox Code Playgroud)

图标呈现像这样

软盘图标根本不呈现(显示无效的字符)加号和减号sig不是粗体,比bootstap网站上显示的要小得多.

我也在rails控制台上看到以下消息.

Started GET "/fonts/glyphicons-halflings-regular.woff" for 127.0.0.1 at 2014-02-22 16:29:54 -0800
ActionController::RoutingError (No route matches [GET] "/fonts/glyphicons-halflings-regular.woff"):

Started GET "/fonts/glyphicons-halflings-regular.ttf" for 127.0.0.1 at 2014-02-22 16:29:54 -0800
ActionController::RoutingError (No route matches [GET] "/fonts/glyphicons-halflings-regular.ttf"):

Started GET "/fonts/glyphicons-halflings-regular.svg" for 127.0.0.1 at 2014-02-22 16:29:54 -0800
ActionController::RoutingError (No route matches …
Run Code Online (Sandbox Code Playgroud)

twitter-bootstrap-rails ruby-on-rails-4 twitter-bootstrap-3

36
推荐指数
5
解决办法
3万
查看次数

如何将自定义字体添加到Rails应用程序?

我有一些我想在我的RoR应用程序中使用的字体,但它们的格式主要是.ttf和.otf等.我如何在Rails应用程序中嵌入这些文件?也就是说,一旦我把它们放在我的资源文件夹中,我将它们嵌入我的CSS和/或LESS文件的语法究竟是什么?

编辑:这是我现在的代码:

@font-face {
    font-family: Vow;
    src: url('/assets/Vow.otf');
}
h1 {
    font-family: Vow;
    text-align: center;
}
Run Code Online (Sandbox Code Playgroud)

它似乎对我不起作用.Rails控制台中的输出类似于:

ActionController::RoutingError (No route matches [GET] "/assets/Vow.otf")
Run Code Online (Sandbox Code Playgroud)

用Firebug检查页面说:

downloadable font: download failed (font-family: "Vow" style:normal weight:normal stretch:normal src index:0): status=2147746065
source: http://localhost:3000/assets/Vow.otf
Run Code Online (Sandbox Code Playgroud)

css fonts ruby-on-rails

23
推荐指数
2
解决办法
3万
查看次数