I am using Rails and Bootstrap. I have a page that works perfectly when you just go to it in the browser. When I go to a different page on my site and then click a link that takes me back to the page, the javascript files load in a completely different order. This does not make sense to me as I load the js files in an explicit order as described in my logged_out.js manifest file:
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require ./logged_out/theme_vendor/bootstrap.min
//= require ./logged_out/theme_vendor/smoothscroll.min
//= require ./logged_out/theme_vendor/jquery.backstretch.min
//= require ./logged_out/theme_vendor/jquery.countTo
//= require ./logged_out/theme_vendor/contact
//= require ./logged_out/theme_vendor/jquery.waypoints.min
//= require ./logged_out/theme_custom/theme
In the browser page, it shows that when I load the page by just going to a url, the files are loaded in the order above. When I get to the page by going through a link, the order of the files are random. How do I fix this so that the files always load in this order?
Another thing to note: I have two manifest files: logged_out.js and logged_in.js. It seems like the order mismatch only happens when I am going from a page with the logged_in.js to the logged_out.js. I need two types of manifest files so there is so deleting either one or moving to one manifest file is not an option.