CSS and JS directories in Rails

Posted by jamie Thu, 28 Sep 2006 14:27:11 GMT

One thing that annoyed me when I first started using Rails at 0.14 was that I was forced to put my .css files in a ‘stylesheets’ directory and my .js files in a ‘javascripts’ directory.

Previous to Rails I would put .css files in a ‘css’ directory and .js files in a ‘js’ directory (call me old fashioned). I use the following code in my application helper to allow me to do this:

module ApplicationHelper
  def javascript_path(source) compute_public_path(source, 'js', 'js') end
  def stylesheet_path(source) compute_public_path(source, 'css', 'css') end
end

Just incase anyone else has the same niggle.

Posted in  | Tags , ,  | 1 comment

Comments

  1. Avatar Branstrom said 6 days later:

    That’s great, I’ve been using short folder names too, as long as I can remember.

(leave url/email »)

   Comment Markup Help Preview comment