Setup Dart Sass in Rails
11 March 2022 (Updated 11 March 2022)
What is the dartsass-rails gem?
The dartsass-rails gem wraps the standalone executable version of the Dart version of Sass. It provides a number of commands that let you create .css files from your .scss files.
Installation
- Run
./bin/bundle add dartsass-rails - Run
./bin/rails dartsass:install - Delete default
app/assets/stylesheets/application.cssif present - Run
./bin/dev
The installer creates default input Sass file at app/assets/stylesheets/application.scss.
Commands
rails dartsass:watch
Start a process to watch for changes in your input file and generate the output file.
Alternatively, you can use ./bin/dev to start dartsass:watch and rails server in the same terminal.
rails dartsass:build
Generate app/assets/builds/application.css from app/assets/stylesheets/application.scss
Sources
Tagged:
Rails tooling
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment