加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

twitter-bootstrap – Glyphicons在Production Rails中没有正确

发布时间:2020-12-17 21:34:16 所属栏目:安全 来源:网络整理
导读:使用Rails 4,我遇到了一个问题,即Bootstrap中的glyphicons没有被正确预编译.生成以下内容: started GET "/assets/glyphicons-halflings-white-ed38e147e3f6e976c0a7ad59e4d628f3.png" for 127.0.0.1 at 2014-01-13 18:41:25 -0500Started GET "/assets/glyp
使用Rails 4,我遇到了一个问题,即Bootstrap中的glyphicons没有被正确预编译.生成以下内容:

started GET "/assets/glyphicons-halflings-white-ed38e147e3f6e976c0a7ad59e4d628f3.png" for          127.0.0.1 at 2014-01-13 18:41:25 -0500
Started GET "/assets/glyphicons-halflings-white-ed38e147e3f6e976c0a7ad59e4d628f3.png" for 127.0.0.1 at 2014-01-13 18:41:25 -0500
Processing by ApplicationController#routing_error as PNG
Processing by ApplicationController#routing_error as PNG
  Parameters: {"path"=>"assets/glyphicons-halflings-white-ed38e147e3f6e976c0a7ad59e4d628f3"}
  Parameters: {"path"=>"assets/glyphicons-halflings-white-ed38e147e3f6e976c0a7ad59e4d628f3"}
  Rendered public/404.html (0.3ms)
  Rendered public/404.html (0.3ms)
Completed 404 Not Found in 17ms (Views: 3.4ms | ActiveRecord: 8.0ms)
Completed 404 Not Found in 17ms (Views: 3.4ms | ActiveRecord: 8.0ms)

它在开发中工作正常.如果我在production.rb中设置config.assets.compile = true它似乎工作正常 – 但我理解基于这个SO问题非常糟糕:
files produced by asset:precompile don’t match urls generated by stylesheet_link_tag (missing digest) in minimal rails 4 site

在Rails 3.2中,这对我来说不是问题.

任何帮助将不胜感激!

解决方法

将应用程序从Rails 3.2升级到4时,我遇到了同样的问题.

生产应用程序托管在Heroku上

一切都在Rails 3.2中运行良好

然而在Rails 4中,雕文在Dev中表现得很好但在制作中却没有.快速检查浏览器控制台显示404为资产路径错误.

就我而言,我需要

config.assets.precompile += [
        'twitter/bootstrap/glyphicons-halflings.png','twitter/bootstrap/glyphicons-halflings-white.png'
      ]

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读