Reputation: 6121
As it says on the tin. It seems like javascript_include_tag :all
includes /assets/all.js
instead of all of them.
Is there a way to just include everything there plus all the subfolders?
Upvotes: 0
Views: 61
Reputation: 2890
Why don't you just use the default generated application.js
?
/app/assets/javascripts/application.js
// 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 vendor/assets/javascripts of plugins, if any, 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
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
Take a note on the last line: //= require_tree .
That should include all your javascript.
/app/view/layouts/application.html.erb
<%= javascript_include_tag "application" %>
http://guides.rubyonrails.org/asset_pipeline.html#manifest-files-and-directives
The require_tree directive tells Sprockets to recursively include all JavaScript files in the specified directory into the output. These paths must be specified relative to the manifest file. You can also use the require_directory directive which includes all JavaScript files only in the directory specified, without recursion.
Upvotes: 3