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

Use the modern Sass API #9857

Open
nex3 opened this issue Jul 19, 2024 · 2 comments · May be fixed by #9966
Open

Use the modern Sass API #9857

nex3 opened this issue Jul 19, 2024 · 2 comments · May be fixed by #9966

Comments

@nex3
Copy link

nex3 commented Jul 19, 2024

Parcel currently uses the deprecated legacy API for compiling Sass code. This API is less efficient and less correct than the modern API, and is slated to be removed in an upcoming Dart Sass 2.0.0 release. In order to encourage users to migrate away before that, we'll be adding a deprecation warning to all uses of the legacy API in one of the next few Sass releases.

Also consider adding support for the sass-embedded package, and particularly the Compiler API. When doing multiple small compilations, this API on the embedded host is much faster than the plain-JS sass package.

@devongovett
Copy link
Member

I was able to migrate our code to use the new API in #9966, but I'm worried that this might be a breaking change for end users. Projects may include a .sassrc.js file containing arbitrary SASS options, and it looks like those have changed between the legacy and modern APIs. In particular, the APIs for functions, importer, pkgImporter, and a few others have changed. Therefore I'm not sure if this will need to wait until the next major version of Parcel. That would be unfortunate since they are already getting warnings. Is there a way for us to map the old API options to the new ones somehow?

@nex3
Copy link
Author

nex3 commented Oct 1, 2024

You could probably make a shim for the legacy functions API with some work (or just fork the one the Sass embedded host uses), and pkgImporter should work the same in both cases. The importer API is the big sticking point: the modern importer API specifically has stronger restrictions to enable better guarantees for the Sass stylesheets, so it's not really feasible to make a general-purpose translation layer for that. You may be able to make something work that supports a particularly well-behaved subset of user-defined importers, though.

Since the legacy API has been deprecated for years now, we're planning to drop support in Dart Sass 2.0.0 which will probably be released some time in Q1 2025. At that point, we unfortunately won't have the bandwidth to keep making CSS compatibility changes to the 1.x line.

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 a pull request may close this issue.

2 participants