Last Updated: February 25, 2016
·
5.966K
· jalada

Using SASS instead of SCSS by default in Rails

Presumably because people love CSS (?) Rails defaults to SCSS when generating stylesheets. I use HAML instead of HTML so SASS is a much better fit.

Add this to config/application.rb:

config.sass.preferred_syntax = :sass

You'll have problems running tasks on Heroku if your sass-rails gem is in the assets gem group now. To fix that, use these lines instead:

if Rails.configuration.respond_to?(:sass)
  Rails.configuration.sass.tap do |config|
    config.preferred_syntax = :sass
  end
end

Thanks.

4 Responses
Add your response

Hi,

I have this problem with heroku, but which file contains this code?

over 1 year ago ·

As I said, you add it to config/application.rb. Is that what you mean?

over 1 year ago ·

Oh, i don't understand that, sorry.
I thought that part of code would go in another file.
So, all code (the sentence and the block) should be in application.rb

Thanks

over 1 year ago ·

Thanks David...

over 1 year ago ·