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

后端 未结 6 1591
无人及你
无人及你 2020-12-12 14:06

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:

6条回答
  •  既然无缘
    2020-12-12 15:06

    As @krainboltgreene commented, adding the following line to config/application.rb

    config.generators.stylesheet_engine = :sass
    

    makes sass the default format for stylesheet generators. However, since Rails 3.1.beta1 doesn't support it, one gets the following error messages

    $ rails g scaffold user name:string
    ...
    Could not find "scaffold.css.sass" in any of your source paths. Your current source paths are:
    .../gems/railties-3.1.0.beta1/lib/rails/generators/rails/scaffold/templates
    ...
    
    $ rails g controller users
    ...
    Could not find "stylesheet.css.sass" in any of your source paths. Your current source paths are: 
    .../gems/railties-3.1.0.beta1/lib/rails/generators/rails/assets/templates
    

    As you see, one cannot change the default format without breaking the generators. Instead, you can manually create extra *.css.sass files, which are working fine with or without scss ones.

提交回复
热议问题