Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support sass-embedded (dart-sass-embedded) #737

Closed
wants to merge 1 commit into from
Closed

Support sass-embedded (dart-sass-embedded) #737

wants to merge 1 commit into from

Conversation

ntkme
Copy link
Contributor

@ntkme ntkme commented Feb 27, 2022

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. The sass-embedded ruby API closely mirrors the current dart-sass JS API in order to properly support with all the latest features.

Hers are the major differences:

  1. sass-embedded gem uses Sass::Embedded namespace that creates a conflict with the old sass gem, meaning it is a breaking change. I do not see it as a big problem as it's been years that original sass gem was deprecated by sassc gem.
  2. The previous default compact output style is no longer supported, the new default is expanded.
  3. Custom functions work differently. There is no module Sass::Script::Functions based custom function loading. The API now takes a Hash of sass function signatures and methods. This new design is due to the addition of ArgumentList 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 existing module to a Hash so that I can get tests to pass, which is not how it is supposed to work.
  4. Custom importers work differently. There is no module Sass::Importers, importers are now just a list of objects.
  5. The ruby Sass::Value types are different from old Sass::Script::Value types.
  6. 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.

@ntkme
Copy link
Contributor Author

ntkme commented Mar 21, 2022

Closing in favor of https://github.com/ntkme/sassc-embedded-shim-ruby

@ntkme ntkme closed this Mar 21, 2022
@ntkme ntkme deleted the sass-embedded branch March 21, 2022 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant