Ruby   发布时间:2022-04-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了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_scheR_917_11845@a_after_migration = false

这是application.css.scss的头

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

@import "simple_form.css.scss";
@import "user_R_917_11845@enus.css.scss";

在application.js中,它有:

//= require bootstrap.min

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

application-05cf37813d76c2bd659271403789374cc118f1a4e@R_772_11241@ec220969577b79ff6514.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_R_917_11845@anualx
user_R_917_11845@enus-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

大佬总结

以上是大佬教程为你收集整理的ruby-on-rails – Rails 4 – 在资源预编译在生产服务器上之后,没有manifest.json全部内容,希望文章能够帮你解决ruby-on-rails – Rails 4 – 在资源预编译在生产服务器上之后,没有manifest.json所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。