10

I'm using the jQuery Tools scrollable library in my Rails 3.1 site with the various assets placed in the vendor/assets folder and it works great.

My question is regarding the best way to organize the various files under vendor/assets. What is the recommended way to organize vendor/assets subfolders? Currently I have this structure:

vendor/assets/
 |-- images/
 |    |-- scrollable/
 |          <various button/gradient images>
 |-- javascripts/
 |    |-- scrollable/
 |          jquery.tools.min.js
 |-- stylesheets/
 |    |-- scrollable/
 |          scrollable-buttons.css
 |          scrollable-horizontal.css

This is a fairly un-DRY what to do this. I feel that all of the 'scrollable' items should be under one folder.

What is the recommended way to do this without having to manipulate the asset pipeline load paths?

Thanks!

J Graham
  • 181
  • 1
  • 7
  • It has a benefit, though. All your images, stylesheets and javascripts are grouped in their own folders and not scattered acrossa a dozen of plugins. – Sergio Tulentsev Jan 06 '12 at 20:20
  • 3
    one plugin in multiple directories is hard to manage. Removing or updating it would be a pain. – lulalala Apr 03 '12 at 02:24

1 Answers1

9

You could organise them this way, which is slightly better in that it keeps stuff related to the plugin in one directory:

vendor/assets/scrollable
 |-- images/
 |    |-- <various button/gradient images>
 |-- javascripts/
 |    |-- jquery.tools.min.js
 |-- stylesheets/
 |    |-- scrollable-buttons.css
 |        scrollable-horizontal.css

I am pretty sure this will work as rails globs all directories under assets/.

Richard Hulse
  • 10,383
  • 2
  • 33
  • 37
  • For the life of me I can't get this to work. I've structured my vendor/assets like this, but when I do something like: //= require scrollable/jquery.tools.min I get a Sprockets::FileNotFound error. How else would I require that? – jsharpe Feb 02 '12 at 22:24
  • 2
    Try adding `javascripts` into the path – Richard Hulse Feb 02 '12 at 22:40
  • 3
    Check this answer: http://stackoverflow.com/questions/8798646/what-are-the-best-practices-when-organizing-assets-in-rails-asset-pipeline – xhh May 09 '12 at 02:42