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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With