Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails include javascripts assets folder recursively

Tags:

I understand how to add one javascript file to rails assets pipeline. Just add

//= require filename 

to application.js

But how can I include many javscripts files under one folder

vendor/assets/javascripts/<js_library>

Or I have to list them all explicitly ?

like image 407
wwli Avatar asked Apr 25 '13 23:04

wwli


1 Answers

//= require_tree .

will require everything in the current directory of your application.js

//= require_tree ./js_library

will require everything in the js_library subdirectory if it is under app/assets/javascripts

If you are are trying to load javascripts under vendor/assets/javascripts, try:

//= require_tree ../../../vendor/assets/javascripts/js_library
like image 127
mccannf Avatar answered Oct 05 '22 09:10

mccannf