ruby-on-rails - 生产中的引导字形错误404

标签 ruby-on-rails twitter-bootstrap-3 bootstrap-sass

我正在使用bootstrap-sass-rails this issue,当我在生产模式下运行rails项目时,出现3x 404错误:

GET http://localhost:3000/assets/twitter/bootstrap/glyphicons-halflings-regular.woff 404 (Not Found) assets/twitter/bootstrap/glyphicons-halflings-regular.woff:1
GET http://localhost:3000/assets/twitter/bootstrap/glyphicons-halflings-regular.ttf 404 (Not Found) assets/twitter/bootstrap/glyphicons-halflings-regular.ttf:1
GET http://localhost:3000/assets/twitter/bootstrap/glyphicons-halflings-regular.svg 404 (Not Found) 

我使用了rake asset:precompile RAILS_ENV = production生成了带有结果的静态文件:
I, [2013-11-07T16:52:25.269370 #12948]  INFO -- : Writing myproject/public/assets/application-3517eb39b597107b3dbccbcbf4f0b3cc.js
I, [2013-11-07T16:52:25.315358 #12948]  INFO -- : Writing myproject/public/assets/application-1459bfe79a6477170658d53257e4a8fd.css
I, [2013-11-07T16:52:25.334356 #12948]  INFO -- : Writing myproject/public/assets/twitter/bootstrap/glyphicons-halflings-regular-8b1bdc16b9e098d67afebbf8d59fcea7.eot
I, [2013-11-07T16:52:25.345360 #12948]  INFO -- : Writing myproject/public/assets/twitter/bootstrap/glyphicons-halflings-regular-8d8305e5b6a807076d3ec68e2f190674.svg
I, [2013-11-07T16:52:25.357360 #12948]  INFO -- : Writing myproject/public/assets/twitter/bootstrap/glyphicons-halflings-regular-946071b70245967633bb3a774c60f3a3.ttf
I, [2013-11-07T16:52:25.367360 #12948]  INFO -- : Writing myproject/public/assets/twitter/bootstrap/glyphicons-halflings-regular-d7e2274ad1d940a0b2ce7480810ab223.woff
etc ...

除了这3个字体文件之外,所有 Assets 都可以正常工作。我整日搜寻,却一无所获。似乎Rails正在寻找没有这3个文件的哈希值的版本,但rake会使用哈希值生成它们

我的config/production.rb:
  config.cache_classes = true
  config.eager_load = true
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  config.serve_static_assets = true
  config.assets.js_compressor = :uglifier
  config.assets.compile = false
  config.assets.digest = true
  config.assets.version = '1.0'
  config.log_level = :info
  config.i18n.fallbacks = true
  config.active_support.deprecation = :notify

编辑

我试图覆盖@ font-face变量,但它似乎并没有删除旧的变量:
@font-face {
  font-family: 'Glyphicons Halflings';
  src: asset-url('twitter/bootstrap/glyphicons-halflings-regular.eot',font);
  src: asset-url('twitter/bootstrap/glyphicons-halflings-regular.eot?#iefix',font) format('embedded-opentype'), asset-url('twitter/bootstrap/glyphicons-halflings-regular.woff',font) format('woff'), asset-url('twitter/bootstrap/glyphicons-halflings-regular.ttf',font) format('truetype'), asset-url('twitter/bootstrap/glyphicons-halflings-regular.svg#glyphicons-halflingsregular',font) format('svg');
}

我现在已加载字形,但仍然出现3x 404错误。

最佳答案

好吧。

我切换到https://github.com/thomas-mcdonald/bootstrap-sass
完全相同的 bootstrap 版本,并且没有问题。

编辑更新

bootstrap-sass已更新。如果仍然存在404错误,则需要按照github页上的说明进行一些更改。

关于ruby-on-rails - 生产中的引导字形错误404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19840540/

相关文章:

ruby-on-rails - Ruby on Rails Ransack 日期时间到日期搜索

ruby-on-rails - 聊天室中的用户状态(聊天通过简单的轮询得到更新)

css - 为什么这个附加的 Bootstrap 按钮没有对齐?

css - 修改自适应模板的 Sass Bootstrap 变量(仅限移动或桌面)

ruby-on-rails - 为 Rails 4.2 启用 SASS 源映射文件

ruby-on-rails - 使用 Mongoid 的 Rails 博客 - 在创建帖子时自动生成短 URL

html - 使用 Bootstrap 不会出现下拉菜单

html - Bootstrap 嵌套网格系统最佳实践

html - 在 pre 标签内的内容左侧获取空白

javascript - 如何在 rails 中使用 webpack 和 bootstrap-sass-loader 加载 Bootstrap