Reputation: 3213
I've some javascript library that I put in the vendor/javascripts, some of them have more than one files so I split them into directories, like:
-- vendor
-- assets
-- javascripts
-- jquery-zAccordion
-- jquery-file-uploader
And I would like to require the directory jquery-zAccordion
and jquery-file-uploader
in my application.js and I found: https://github.com/sstephenson/sprockets/issues/183#issuecomment-2007808.
I would like to ask, it has been 5 month, is there a solution for this or still we have to use the workaround of using a proxy file?
Upvotes: 4
Views: 3488
Reputation: 11198
This should do it:
//= require_directory ./jquery-zAccordion
Upvotes: -1
Reputation: 446
You can include the following in your application.js file:
//= require_tree ../../../vendor/assets/javascripts
And also for the records, you can do the same for stylesheets in application.css:
*= require_tree ../../../vendor/assets/stylesheets
Upvotes: 4
Reputation: 3137
I guess you need to extend the assets path like this in your config/application.rb file
config.assets.paths << "#{Rails.root}/vendor/assets/javascripts/jquery-zAccordion"
@RyanBigg correct me if i am wrong..
Upvotes: 2