Summary file naming: hyphens, underscores, caps

Has anybody ever seen a great concise summary of best practices for file naming for a Rails project.

  1. Ruby classes: Underscores, all lower case
  2. Coffeescript/Javascript: hyphens (why? )
  3. Sass: ? Maybe hyphens?
  4. Haml, ERB: Underscores
  5. Yaml files?
  6. Directories (underscores always?)
  7. What else?

The only thing consistent seems to be:

  1. No caps (except ? )
  2. No spaces

Underscores in file/directory names is a convention that is adopted in the Ruby community.

In JavaScript/CoffeeScript community underscores are predominant in filenames.

AFAIK, Sass has adopted the underscore convention as well.

To summarize, in a Ruby/Rails project use underscores everywhere (JS/CS could be either underscored or hyphenated).

Thanks @greg. I noticed this line in the Thoughtbot style guide. That was what piqued my curiosity.

Use hyphen-separated filenames, such as