微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ruby-on-rails – Rails 4 – 在资源预编译在生产服务器上之后,没有manifest.json

这是Rails 4.2应用程序的应用程序/资产/

有3个引导js和css文件.部署到生产(ubuntu 12.1)后,资产预编译已在服务器上完成(部署在suburi下):

RAILS_ENV=production bundle exec rake assets:precompile RAILS_RELATIVE_URL_ROOT=/mysuburi

这里是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_files = false #ENV['RAILS_SERVE_STATIC_FILES'].present?
  config.assets.compress = true
  config.assets.js_compressor = :uglifier
  config.assets.compile = false
  config.assets.digest = true
  config.log_level = :debug
  config.i18n.fallbacks = true
  config.active_support.deprecation = :notify
  config.log_formatter = ::Logger::Formatter.new
  config.active_record.dump_schema_after_migration = false

这是application.css.scss的头

@import "bootstrap.min.css";
@import "bootstrap-theme.min.css";

@import "simple_form.css.scss";
@import "user_menus.css.scss";

在application.js中,它有:

//= require bootstrap.min

这是公共/资产/生产服务器上的ls的输出

application-05cf37813d76c2bd659271403789374cc118f1a4e616ec220969577b79ff6514.css
application-375b4b5d8fc285716f4fdca966aa960912efe8292242df8f1a60b99d5caa4b02.js
authentify
banquet_coursex
banquetx
biz_workflowx
commonx
glyphicons-halflings-regular-5d234508037dc13a419ef6ce48f3fc73dbb477f1a162c052b872182b494e626e.svg
glyphicons-halflings-regular-bd18efd3efd70fec8ad09611a20cdbf99440b2c1d40085c29be036f891d65358.ttf
glyphicons-halflings-regular-f495f34e4f177cf0115af995bbbfeb3fcabc88502876e76fc51a4ab439bc8431.eot
glyphicons-halflings-regular-fc969dc1c6ff531abcf368089dcbaf5775133b0626ff56b52301a059fc0f9e1e.woff
jquery-ui
searchx
state_machine_logx
user_manualx
user_menus-7c46e17f4172c2a954eeaf85e80b4e030d1ed0fb3927288bbe07eeb4fb8cbfc5.css

通过与其他Rails应用程序进行比较,它在/ assets下缺少manifest.json.我们尝试在config / environment / production.rb中的各种配置选项无效.在生产服务器上工作的唯一选项是config.assets.compile = true(不推荐)的实时编译.我们的代码导致资产预编译失败有什么问题?

更新:我们从根本上重新构建了Rails应用程序,资产问题保持不变.此资产预编译问题可能与我们怀疑在config / production.rb’和’config / initializers / aseets.rb中的设置无关.回滚版的bundler和rake没有帮助.在同一个生产服务器上运行的另一个Rails 4.2应用程序中也使用了相同的引导程序css和js文件,而没有问题.

解决方法

如果您使用链轮3.x,清单文件现在命名为.sprockets-manifest-md5hash.json,它在 Upgrading Guide

原文地址:https://www.jb51.cc/ruby/273246.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐