Glyphicons Pro 图标在 Rails 4.2/Bootstrap 中无法正确显示
Glyphicons Pro icon not showing correctly in Rails 4.2/Bootstrap
在线购买 Glyphicons 后,我将 glyphicons regular
与 Bootstrap (3.3.6) 集成到 Rails 4.2 应用程序中。之前glyphicon halfings
已经被别人整合了
我所做的是将 5 个 Glyphicon 文件 (svg, ttf, eot, woff, woff2
) 复制到 glyphicons/web/bootstrap-example/fonts/
到 assets/fonts/
。还复制了 plyphicons/web/bootstrap-example/css/glyphicons.css
到 `assets/stylesheets/'.
以下是 Rails 资产下的文件:
问题是 glyphicon regular
中的图标没有显示。
在application.css.scss
中添加@import glyphicons.css
问题是字形显示不正确。这是药草代码:
<%= link_to '<i class="glyphicons glyphicons-eye-open"></i> Free Trial Now'.html_safe,... %>
它显示了一个在 4 个角上带有字符(无法读取)的方框。见下图:
我们的流程中缺少什么?
嗯,首先你应该做的是打开浏览器调试控制台(Ctrl+shift+i chrome)并列出导致此错误的错误。
通常第三方 .css 文件中总会有一些图像引用。
当您整合这些文件时,您需要根据需要更改图像 url/path。
这样试试:
这是在 link
中使用字形的正确方法
<td><%= link_to edit_user_path(user) do %>
<i class="glyphicons glyphicons-eye-open" title='Edit'></i>
<% end %>
</td>
你需要做其他事情才能工作,
查看本教程:
http://www.erikminkel.com/2013/09/01/twitter-bootstrap-3-in-a-rails-4-application/
因为样式表在 Rails 中的 /assets
下。 glyphicon.css
中的fonts
需要替换为assets
。修改后,glyphicon PRO 开始工作了!
在线购买 Glyphicons 后,我将 glyphicons regular
与 Bootstrap (3.3.6) 集成到 Rails 4.2 应用程序中。之前glyphicon halfings
已经被别人整合了
我所做的是将 5 个 Glyphicon 文件 (svg, ttf, eot, woff, woff2
) 复制到 glyphicons/web/bootstrap-example/fonts/
到 assets/fonts/
。还复制了 plyphicons/web/bootstrap-example/css/glyphicons.css
到 `assets/stylesheets/'.
以下是 Rails 资产下的文件:
问题是 glyphicon regular
中的图标没有显示。
在application.css.scss
中添加@import glyphicons.css
问题是字形显示不正确。这是药草代码:
<%= link_to '<i class="glyphicons glyphicons-eye-open"></i> Free Trial Now'.html_safe,... %>
它显示了一个在 4 个角上带有字符(无法读取)的方框。见下图:
我们的流程中缺少什么?
嗯,首先你应该做的是打开浏览器调试控制台(Ctrl+shift+i chrome)并列出导致此错误的错误。
通常第三方 .css 文件中总会有一些图像引用。 当您整合这些文件时,您需要根据需要更改图像 url/path。
这样试试:
这是在 link
中使用字形的正确方法 <td><%= link_to edit_user_path(user) do %>
<i class="glyphicons glyphicons-eye-open" title='Edit'></i>
<% end %>
</td>
你需要做其他事情才能工作,
查看本教程: http://www.erikminkel.com/2013/09/01/twitter-bootstrap-3-in-a-rails-4-application/
因为样式表在 Rails 中的 /assets
下。 glyphicon.css
中的fonts
需要替换为assets
。修改后,glyphicon PRO 开始工作了!