简体   繁体   中英

JavaScript not working on Production locally and heroku

I have searched for solutions for this issue and i have found that i have to run bundle exec rake assets:precompile before pushing to heroku inorder to make JavaScript working but its not working i don't know why. and the same for the local production

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 .

Update: it not working in development. it was working few minutes ago.. :|

Update 2: it worked in development after reordering my application.js to the following:

//= 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 .

and still doesn't work in production

您应该设置:

config.assets.compile = true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM