views:

102

answers:

1

Would anyone know to change the default stylesheet directory /public/stylesheets to /public/css in rails 3?

I found a variable called config.stylesheets_dir = '/css'

This didn't work though.

I know I can do <%= stylesheet_link_tag '/css/mystyle.css' %> but I'm curious if there's a better way.

+2  A: 

Javascript and stylesheets paths were not fully dehardcoded in Rails 3. To override these paths you need to monkey patch (with all consequences of that) private method:

module ActionView::Helpers::AssetTagHelper
    private
      def compute_stylesheet_paths(*args)
          expand_stylesheet_sources(*args).collect { |source| compute_public_path(source, 'stylesheets', 'css', false) }
      end
end

and additionaly this one if you use it:

  def stylesheet_path(source)
    compute_public_path(source, 'stylesheets', 'css')
  end
gertas