hrsetyono
hrsetyono

Reputation: 4464

Rails 4 - JS Pipeline, put after require_tree

I have app.js which depends on around 10 other JS. So I want to put app.js last in the order

//= require_tree .
//= require app

But the way above doesn't work and still list them alphabetically.

I can do this, but not elegant:

//= require js_file01
...
//= require js_file10
//= require app
//= require_tree .

I can also change app.js name into zzzzz.js and call it a day. But is there proper way to include it last?

Thanks

Upvotes: 1

Views: 36

Answers (1)

Ryan Bigg
Ryan Bigg

Reputation: 107728

require_tree will require the files in whatever order it feels like. If you want them required in the order you want, then you will need to have many require calls.

Alternatively, you could put all those other files into one directory, then require_tree that_directory and then require app immediately after that.

Upvotes: 3

Related Questions