title: Is it okay to change the loading order of JavaScript files in Rails 4?
body: <p>In my <code>application.js.coffee</code> I define some overarching functions which I use in my other JavaScript files. So far this was no problem, because except in <code>application.js.coffee</code> most of the code was wrapped in document ready <code>$ -&gt;</code></p>
  
  <p>Now I am optimizing loading time, for instance running AJAX requests outside of <code>$ -&gt;</code> to start the data loading beforehand.</p>
  
  <p>Now I need the functions I have defined, which are of course not available since <code>application.js.coffee</code> is loaded at the very end. To solve this I replaced</p>
  
  <pre><code> #= require_tree .
  </code></pre>
  
  <p>with</p>
  
  <pre><code> #= require_self
   #= require_tree .
  </code></pre>
  
  <p>Is this the way to do it, or is that proscribed? </p>