I have couple of js files in application.js file. Such as;
//= require jquery //= require jquery_ujs //= require dropzone //= require jquery.cookie //= require toastr //VENDOR JS BEGINS //= require pace/pace.min //= require modernizr.custom //= require jquery-ui/jquery-ui.min //= require boostrapv3/js/bootstrap.min //= require jquery/jquery-easy //= require jquery-unveil/jquery.unveil.min //= require jquery-bez/jquery.bez.min //= require jquery-ios-list/jquery.ioslist.min //= require jquery-actual/jquery.actual.min //= require jquery-scrollbar/jquery.scrollbar.min //= require bootstrap-select2/select2.min //= require switchery/js/switchery.min //= require imagesloaded/imagesloaded.pkgd.min //= require jquery-isotope/isotope.pkgd.min //= require classie/classie //= require codrops-stepsform/js/stepsForm //= require bootstrap-datepicker/js/bootstrap-datepicker //= require bootstrap-datepicker/js/locales/bootstrap-datepicker.tr.js //= require bootstrap-datepicker/js/locales/bootstrap-datepicker.en.js //= require summernote/js/summernote.min //= require moment/moment-with-locales.min //= require bootstrap-daterangepicker/daterangepicker //= require bootstrap-timepicker/bootstrap-timepicker.min //= require codrops-dialogFx/dialogFx //= require ion-slider/ion.rangeSlider.min //= require owl-carousel/owl.carousel.min I have also couple of js codes in the html.erb pages. But I want to take all page specific js codes into 1 file. This file should be called after page loads. Because some of them uses ruby code such as init lat lng of google maps. Also, couple of js files such as;
//= require codrops-dialogFx/dialogFx //= require ion-slider/ion.rangeSlider.min works after page loads. So, they do not work as I put them to head tag as;
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> So If I, design application.js as;
//= require jquery //= require jquery_ujs //= require dropzone //= require jquery.cookie //= require toastr Then call <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> in head tag then call all the other js files in the body tag like
<%= javascript_include_tag 'pace/pace.min', 'data-turbolinks-track' => true %> <%= javascript_include_tag 'modernizr.custom', 'data-turbolinks-track' => true %> <%= javascript_include_tag 'jquery-ui/jquery-ui.min', 'data-turbolinks-track' => true %> <%= javascript_include_tag 'boostrapv3/js/bootstrap.min', 'data-turbolinks-track' => true %> .... Does rails precompiles these files also?. I have these js files in vendor file.