【问题标题】:rails glyphicons not uploaded in productionrails glyphicons 未在生产中上传
【发布时间】:2015-11-05 14:54:31
【问题描述】:

我无法在我的 rails 4 应用中上传生产环境中的字形图标。

so question 这样的解决方案对我不起作用。

我的 application.css.scss 文件包含以下几行:

@import "bootstrap-sprockets";
@import "bootstrap";
$icon-font-path: "bootstrap/";

application.css 文件中的 glyphicons 字体在生产上是正确的路径,例如:

url("/assets/bootstrap/glyphicons-halflings-regular-8cd45fc682c0e3a2695ce9453750efec.woff2") format("woff2")

我尝试下载此文件(mydomain.com/assets/bootstrap/glyphicons-halflings-regular-8cd45fc682c0e3a2695ce9453750efec.woff2)并且我已经下载了它,这意味着文件存储在正确目录中的服务器中。在我的浏览器中,我没有看到 404 错误。

但我注意到一件让我很困惑的事情,在本地我可以看到下载的 glyphicons 字体:

在生产中,我在网络选项卡中看不到该文件:

并且没有js错误

为什么 glyphicons 不能在 rails 的生产模式下加载?

【问题讨论】:

  • 你看过了吗:stackoverflow.com/questions/10905905/…,你可能需要在预编译列表中添加字体文件扩展名。
  • @danielrsmith 在服务器上将预编译的字体存储在 my_app/public/assets/bootstrap 目录中,我可以下载它,我的问题是即使字体的正确路径,字体也不会在浏览器中上传字体文件(带摘要)在 css 规则中,我不知道为什么。
  • 嗯,通常我使用github.com/twbs/bootstrap-sass,因为它使这个过程超级简单,并且不会用供应商代码阻塞你的仓库。

标签: ruby-on-rails twitter-bootstrap glyphicons


【解决方案1】:

我已将 bootstrap-sass gem 从 3.3.5 降级为 3.3.0.1,并且 glyphicons 可以正常工作。

更新:更新 gem 'sass-rails', '>= 5.0.0' 与此 issue 对应,现在 glypicons 与 bootstrap-sass gem 3.3.5 的版本可以正常工作

【讨论】:

    猜你喜欢
    • 2014-02-01
    • 2015-11-13
    • 2017-08-18
    • 1970-01-01
    • 1970-01-01
    • 2015-12-14
    • 2013-09-13
    • 2014-09-29
    • 1970-01-01
    相关资源
    最近更新 更多