LoginSignup
5

More than 1 year has passed since last update.

Rails で *.scss じゃなく *.sass を生成してほしい

Last updated at Posted at 2016-07-06

Rails でスタイルシートに SCSS じゃないほうの Sass(これを簡潔に何と呼ぶべき?) が使いたい。

Gemfile に sass-rails が入っていれば(デフォルトでは入っている),拡張子 .sass のファイルを作るだけのことなので,とくに何も設定しなくても大丈夫。

ただ,scaffold などで自動的に生成されるスタイルシートが,デフォルトでは .scss になってしまう。

これを .sass にするには,以下のように書けばよいようだ。

config/application.rb
module NantokaKantoka
  class Application < Rails::Application
    config.sass.preferred_syntax = :sass
  end
end

追記(2022-02-10)

「SCSS じゃないほうの Sass」は,文法(構文)の名称としては「インデント構文(the indent syntax)」でした。
公式のドキュメント
https://sass-lang.com/documentation/syntax#the-indented-syntax

インデント構文は Sass の最初の構文(original syntax)です

というようなことが書かれています。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5