Support sass-embedded (dart-sass-embedded) #737
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Disclaimer: This is a draft PR just for interest check. It is not how
sass-embedded
gem is indented to be integrated, as I only hacked quickly to get all tests to pass as a proof of concept.With libsass and sassc-ruby being deprecated and no replacement for a long time, I see the community started to think about other approach like rails/dartsass-rails, where many sprockets features today would be missing (e.g. ability to write custom sass functions & importers in ruby). However, the situation has changed, I'm happy to announce the 1.0 release of sass-embedded gem that provides a ruby language API for dart-sass-embedded compiler.
First of all,
sass-embedded
uses the officially support dart-sass-embedded compiler and is very different from the previous two ruby sass implementations. Thesass-embedded
ruby API closely mirrors the currentdart-sass
JS API in order to properly support with all the latest features.Hers are the major differences:
sass-embedded
gem usesSass::Embedded
namespace that creates a conflict with the oldsass
gem, meaning it is a breaking change. I do not see it as a big problem as it's been years that originalsass
gem was deprecated bysassc
gem.compact
output style is no longer supported, the new default isexpanded
.module Sass::Script::Functions
based custom function loading. The API now takes aHash
of sass function signatures and methods. This new design is due to the addition ofArgumentList
type in dart-sass which cannot be mapped to ruby arguments without ambiguity, as well as the need of access tracking of keyword arguments. In this proof of concept, I did a hack that converts the existingmodule
to aHash
so that I can get tests to pass, which is not how it is supposed to work.module Sass::Importers
, importers are now just a list of objects.Sass::Value
types are different from oldSass::Script::Value
types.sass-embedded
requires ruby >=2.6. The CI tests will fail.I opened this mainly to seek comments from the maintainers and the community. I'd like to know if the community is interested, and if so whether the rails team would like to driver the real development of this integration.