In the public folder we have stylesheets, javascripts and images.
I want to add a front-end feature that has it’s own css, js and images, but according to this hierarchy i have to store them like this:
stylesheets/calendar/main.css
javascripts/calendar/cal.js
javascripts/calendar/cal2.js
images/calendar/front.jpg
images/calendar/button1.jpg
images/calendar/button2.jpg
images/calendar/button3.jpg
I don’t like that I split the feature up at all.
Is there a way to organize files per feature instead?
calendar/stylesheets/main.css
calendar/javascripts/cal.js
calendar/javascripts/cal2.js
calendar/images/front.jpg
calendar/images/button1.jpg
calendar/images/button2.jpg
calendar/images/button3.jpg
That would be a better structure, following OOP pattern.
As the others mention, you can do pretty much anything you like.
This is the system we are currently using:
Place files inside directories corresponding to the “layout” they are applicable to:
Top-level directories (/images /javascripts /stylesheets) are used for elements that are genuinely common (such as jquery, css reset scripts and standard logos).
Client-side library packages be maintained in their own directory rather than spread out into the standard Rails directories. This greatly aids long term maintenance.
Using colorbox as an example:
Rather than:
We have: