JavaScript无法在本地生产和heroku

时间:2013-09-20 11:40:47

标签: javascript ruby-on-rails heroku

我已经搜索了这个问题的解决方案,我发现我必须运行bundle exec rake资产:在推送到heroku之前预编译以使JavaScript工作但它不工作我不知道为什么。和本地生产相同

production.rb

  config.cache_classes = true
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  config.serve_static_assets = true
  config.assets.compress = true
  config.assets.compile = false
  config.assets.precompile += %w( chartkick.js )
  config.i18n.fallbacks = true
end

的application.js

//= require jquery_ujs
//= require jquery
//= require jquery.ui.all
//= require bootstrap
//= require demo1
//= require polyfills
//= require announcements
//= require wice_grid
//= require ckeditor/init
//= require bootstrap-datepicker
//= require_tree .

更新:它不能用于开发。它几分钟前工作..:|

更新2:在将application.js重新排序到以下内容后,它在开发中工作:

//= require jquery_ujs
//= require bootstrap
//= require jquery
//= require jquery.ui.all
//= require demo1
//= require polyfills
//= require announcements
//= require wice_grid
//= require ckeditor/init
//= require bootstrap-datepicker
//= require_tree .

仍然无法在生产中使用

1 个答案:

答案 0 :(得分:1)

您应该设置: -

config.assets.compile = true