views:

37

answers:

2

So I've recently started to include quite a few .js files in to my web application and some of them depend on each other so load order is important.

However rails caching just seems to load a all.js file with no particular order to the files.

What's a good way to solve this issue?

A: 

I've been experimenting with the YUILoader Module, it seems pretty nifty, though I am currently frussing about loading up custom modules. It's totally doable, I just couldn't figure it out in 5 mins.

http://developer.yahoo.com/yui/yuiloader/ (YUI2.8.1) http://developer.yahoo.com/yui/examples/yuiloader/index.html

Danjah
+2  A: 

You can do as follows

  • First, load the default JavaScript files.
  • Then load other scripts in the order that you want

    <%= javascript_include_tag :defaults %>
    <%= javascript_include_tag "script_1", "script_2", "script_3" %>

Hoa