sassc-embedded-shim-ruby
sassc-embedded-shim-ruby copied to clipboard
:gem: A Ruby shim for SassC that will communicate with Embedded Dart Sass using the Embedded Sass protocol
Embedded Sass Shim for SassC Ruby
Use sass-embedded with SassC Ruby!
This library shims sassc with the sass-embedded implementation.
Which Sass implementation should I use for my Ruby project?
sass-embeddedis recommended for all projects. It is compatible with:sassc-embeddedis recommended for existing projects still usingsasscorsprockets. It is compatible with:sasscis deprecated.sasshas reached end-of-life.
Install
Add this line to your application's Gemfile:
gem 'sassc-embedded'
And then execute:
bundle
Or install it yourself as:
gem install sassc-embedded
Usage
This shim utilizes sass-embedded to allow you to compile SCSS or SASS syntax to CSS. To compile, use a SassC::Engine, e.g.:
require 'sassc-embedded'
SassC::Engine.new(sass, style: :compressed).render
See rubydoc.info/gems/sassc for full API documentation.
Behavioral Differences from SassC Ruby
-
Option
:style => :nestedand:style => :compactbehave as:style => :expanded. -
Option
:precisionis ignored. -
Option
:line_commentsis ignored.
See the dart-sass documentation for other differences.
Troubleshooting
The original sassc gem is still being used instead of sassc-embedded
When launching an application via bundle exec, it puts sassc-embedded at higher priority than sassc in $LOAD_PATH. You can verify the order of $LOAD_PATH with the following command:
bundle exec ruby -e 'puts $LOAD_PATH'
If you see sassc has higher priority than sassc-embedded, try remove sassc:
bundle remove sassc
If your application has a transitive dependency on sassc that cannot be removed, you can use one of the following workarounds.
Workaround One
Add this line to your application's Gemfile:
gem 'sassc', github: 'sass/sassc-ruby', ref: 'refs/pull/233/head'
And then execute:
bundle
The fork of sassc at https://github.com/sass/sassc-ruby/pull/233 will load the shim whenever require 'sassc' is invoked, meaning no other code changes needed in your application.
Workaround Two
Add this line to your application's code:
require 'sassc-embedded'