Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Rails 3.1 use SASS (Over SCSS) as the default?

Having a hard time figuring out how to make SASS, not SCSS, as the default for stylesheets.

I've tried making a sass_config.rb file with this:

Sass::Plugin.options[:syntax] = :sass
Sass::Plugin.options[:style] = :compressed

I've also tried adding that to the environment.rb file. Either way I get this error:

.../config/environment.rb:7:in `<top (required)>': 
  uninitialized constant Sass::Plugin (NameError)
like image 220
krainboltgreene Avatar asked May 15 '11 03:05

krainboltgreene


4 Answers

For rails 3.1.rc4, you could set the config:

config.sass.preferred_syntax = :sass

in the application.rb file

like image 167
Kevin Avatar answered Nov 03 '22 17:11

Kevin


I added the following to config/environments/development.rb:

config.sass.preferred_syntax = :sass

That did the trick.

like image 33
remino Avatar answered Nov 03 '22 18:11

remino


Do require 'sass/plugin' and make sure it's at the bottom after your Application.initialize! call.

like image 7
aceofspades Avatar answered Nov 03 '22 16:11

aceofspades


I definitely prefer sass to scss too - have you considered just using the compass gem for all your CSS, and adding preferred_syntax = :sass to config/compass.rb

I haven't tested this out yet on rails 3.1 yet but it works in 3.0.7

EDIT

As a troubleshooting step, what happens when you remove just the first line of code from sass_config.rb so that it just has the second one? Do both these lines cause the error?

like image 2
stephenmurdoch Avatar answered Nov 03 '22 17:11

stephenmurdoch