简体   繁体   中英

Rails Javascript not executing, assets compiled correctly

I am having a issue with javascript not running properly on my production environment. I precompiled my assets with

rake assets:precompile RAILS_ENV=production

before pushing code up to git and heroku but it refuses to execute bootstrap's js functions, google analytics/new relic code, menus, image sliders, etc. Here's my application.js

//= require jquery
//= require bootstrap
//= require jquery_ujs
//= require menu
//= require jquery-ui/autocomplete
//= require autocomplete-rails
//= require jquery-ui/accordion
//= require jquery-ui/tooltip
//= require jquery.raty
//= require search
//= require sameheights
//= require nprogress
//= require sweet-alert
//= require sweet-alert-confirm
//= require select2
//= require ratyrate
//= require local_time
//= require tinymce-jquery
//= require fancybox
//= require_tree .

When I inspect the page, there are no errors or warnings. Some of these functions work correctly on development, but not all. I tried removing each of the lines one by one to see if I could find a culprit but no luck. In fact, since the last time I precompiled assets, the only files that were added were menu, search, and sameheights so everything was working fine beforehand.

Additionally, my production environment correctly sees the minified application.js and application.css files with all the pertinent functions and I have already checked for dupes as well. HELP!

It seems that the issue might be with either jquery or bootstrap. I removed both gems and added cdn hosted versions and it seems to have resolved the issues.

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