Dart Sass for Ruby
Notice: This gem is deprecated and no longer maintained. Please use sassc-embedded-shim-ruby. Note sassc-embedded-shim-ruby is a misnomer, it actually provides Dart Sass functionality.
Use Dart Sass with Ruby.
This gem is a fork of sass/sassc-ruby. It is a compatibility shim which attempts to replicate SassC functionality on Dart Sass, providing an easy upgrade path. Under-the-hood, this gem delegates to the sass-embedded gem which provides native binaries for Dart Sass instead of SassC (libsass).
Important: When Dart Sass 2.0 is released, this gem will be sunset and relevant code will be migrated to dartsass-sprockets. Please see this issue for details.
For ease of upgrading, the root namespace ::SassC
is still used by this gem,
although it is now a misnomer.
Installation
Rails/Sprockets users are recommended to use dartsass-sprockets instead of this gem directly. In your Gemfile:
gem 'dartsass-sprockets'
Upgrading to Dart Sass
This gem is a drop-in replacement to sassc-ruby. Note the following differences:
- Option
style: :nested
andstyle: :compact
behave asstyle: :expanded
. Usestyle: :compressed
for minification. - Option
:precision
is ignored, as Dart Sass sets it to a sufficiently high value. - Option
:line_comments
is ignored and will always be disabled. -
Sass2Scss
functionality has been removed.
See the dart-sass documentation for other differences.
Usage
This library utilizes dart-sass to compile
SCSS or SASS syntax to CSS. To compile, use a SassC::Engine
, e.g.:
SassC::Engine.new(".klass1, .klass2 { color: :red; }", style: :compressed).render
Alternatives
- dartsass-rails: The Rails organization maintains its own wrapper for Dart Sass. Unlike this gem, dartsass-rails does not support Sprockets.
Credits
- This gem is maintained and used in production by TableCheck. (We'd be very glad if the Sass organization could take over maintainership in the future!)
- Kudos to @ntkme for Dart Sass support and maintaining the sass-embedded gem.
- Credit to Ryan Boland and the authors of the original sass/sassc-ruby gem.
- See our awesome contributors.
Contributing
- Fork it (https://github.com/tablecheck/dartsass-ruby/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - try to include tests - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request