How to serve images from subfolders in Javascript via Asset pipeline

So I have a folder in my assets/javascripts folder that runs an image slideshow called galleryview. Inside this folder is a themes directory holding images for my "next" and "previous" buttons thus...


now the javascript running this, links to these images via this....

//Determine path between current page and filmstrip images
//Scan script tags and look for path to GalleryView plugin
            var s = $(this);
            if(s.attr('src') && s.attr('src').match(/jquery\.galleryview/)){
                img_path = s.attr('src').split('jquery.galleryview')[0]+'themes/';

HOWEVER, I'm using this in a Rails app now, so I need to point this img_path line to


so what should my imag_path look like now?

img_path = ?

Here is the entire javascript file code on jsfiddle....copy and past this into an editor and the area I'm interested in is around line 389.


Not sure this code will exactly work, but I think you can use the image_path helper to get you close. Something like:

img_path = <%= image_path 'images/'%>;

Put this inside a .js.erb file and the ERB shown above should be parsed and output the string "/assets/images/", assigning img_path to the value "/assets/themes/"

Of course, you could also just do:

img_path = "/assets/images/";

...but the upside of using the helper, I guess, is in case that the "assets" path ever changes you won't need to update a hard-coded string.

Need Your Help

T-SQL Re-order rows in table

sql sql-server-2008 tsql

Apolgoies in advance if this is a repeated question, which I failed to look up :(

What are the exact conditions based on which Linux swaps process(s) memory from RAM to a swap file?

linux linux-kernel swap virtual-memory swapfile

My server has 8Gigs of RAM and 8Gigs configured for swap file. I have memory intensive apps running. These apps have peak loads during which we find swap usage increase. Approximately 1 GIG of swap...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.