In the years I have been working with Rails I have generally been happy to follow the conventions that it enforces. There is one that just doesn’t sit right with me and that is the decision to store .css files in a ‘stylesheets’ directory and .js files in a ‘javascripts’ directory as I prefer ‘css’ and ‘js’ directories (call me old fashioned).
Achieving this in Rails 2.2 involves changing a couple of constants. I may submit a patch with a config hook for this as it feels a little dirty changing the constants directly. Add the following lines to your environment.rb file.
ActionView::Helpers::AssetTagHelper::StylesheetAsset::DIRECTORY = 'css'.freeze
ActionView::Helpers::AssetTagHelper::JavaScriptAsset::DIRECTORY = 'js'.freeze
Nice idea, I had to do something like this once to replace a legacy system with a bunch of external dependencies on its stylesheets.
What about images?
Hi Ed,
For images you could redefine as follows:
Jamie
This really goes against the convention over configuration ideology of rails (which you already know), and imo – isn’t one worth toying with. May as well start playing with the naming conventions, because someone simply doesn’t like what it’s called. I’m in agreeance with you – I think css/js are much better directory names, but changing the application to match my own taste in naming is a waste of time.