Completely disabling Sprockets

697 views Asked by At

I am trying to completely remove Sprockets from a Rails 6.1.3.2 with Ruby 3.0 project

One of the Stackoverflow question/answers said that I need to remove the sass-rails gem from the Gemfile.

Per the sass-rails gem Github repo:

This gem provides official integration for Ruby on Rails projects with the Sass stylesheet language.

So, why would it have to be removed if I wanted to write .scss stylesheets instead of .css stylesheets?

1

There are 1 answers

1
max On BEST ANSWER

The sass-rails gem was actually deprecated.

It's a rails (sprockets) wrapper for the venerable Ruby SASS compiler which is extremely slow. It was replaced in 2019 by sassc-rails which used libsass (which is written in C) until that was also axed. In Rails 7, sassc-rails became the default. It is recommended to move away from sass-rails

The primary implementation of SASS is now Dart Sass. You can install it through Node.js, Homebrew, Chocolate, Scout-App etc. You integrate it with webpack through the Sass-loader package.

It supports features like the new module system @use that replaces the problematic @include that are starting to show up in cutting edge frameworks and will be blazingly fast compared to the old Ruby compiler.