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

Migrate to the new dart-sass JavaScript API #837

Open
cb-eli opened this issue Dec 12, 2021 · 4 comments · May be fixed by #846
Open

Migrate to the new dart-sass JavaScript API #837

cb-eli opened this issue Dec 12, 2021 · 4 comments · May be fixed by #846

Comments

@cb-eli
Copy link

cb-eli commented Dec 12, 2021

In dart-sass v1.45.0 a new JavaScript API was introduced which suppose to be "more idiomatic, performant, and usable than the old one".
Can you please update the library to use the new API?

Thank you!

@xzyfer
Copy link
Collaborator

xzyfer commented Dec 28, 2021

This package is in maintenance mode. We aim to resolved security issues and general high priority maintenance. In this case we're open to pull requests as the existing dart-sass API appears to still be working.

@wkillerud
Copy link

I've been experimenting with a solution here. I've tested it in a project that uses a custom importer, and with or without source maps, and with both Dart Sass and the new Embedded Sass. It looks like it's working fine, so I can open a pull request if you'd like.

The gist of it is to replace calls to render and renderSync with the new compileAsync and compile. That requires some adapting, particularly in filePush. It also means a breaking change, since the options API is changed.

I suppose a breaking change could be avoided by keeping the current code, and have the new API be opt-in somehow. Personally I'd opt to go for a breaking change sooner than later, since the legacy API is going to be removed in the next major version of Sass anyway, but that's up to you 😄

Let me know if I can help!

wkillerud added a commit to wkillerud/gulp-sass that referenced this issue Mar 2, 2022
The legacy render API will be removed in sass 2.0. Keep the legacy
API as an option, but default to the new API to encourage adoption.

Fixes dlmanning#837
wkillerud added a commit to wkillerud/gulp-sass that referenced this issue Mar 2, 2022
The legacy render API will be removed in sass 2.0. Keep the legacy
API as an option, but default to the new API to encourage adoption.

Fixes dlmanning#837
wkillerud added a commit to wkillerud/gulp-sass that referenced this issue Mar 2, 2022
The legacy render API will be removed in sass 2.0. Keep the legacy
API as an option, but default to the new API to encourage adoption.

Fixes dlmanning#837
wkillerud added a commit to wkillerud/gulp-sass that referenced this issue Mar 2, 2022
The legacy render API will be removed in sass 2.0. Keep the legacy
API as an option, but default to the new API to encourage adoption.

Fixes dlmanning#837
wkillerud added a commit to wkillerud/gulp-sass that referenced this issue Mar 2, 2022
The legacy render API will be removed in sass 2.0. Keep the legacy
API as an option, but default to the new API to encourage adoption.

Fixes dlmanning#837
wkillerud added a commit to wkillerud/gulp-sass that referenced this issue Mar 2, 2022
The legacy render API will be removed in sass 2.0. Keep the legacy
API as an option, but default to the new API to encourage adoption.

Fixes dlmanning#837
wkillerud added a commit to wkillerud/gulp-sass that referenced this issue Mar 2, 2022
Keep the legacy API around, since its removal is still probably a
while from now.

Fixes dlmanning#837
@wkillerud wkillerud linked a pull request Mar 2, 2022 that will close this issue
@wkillerud
Copy link

I took the liberty of opening a PR @xzyfer

(sorry for the associated commit spam, I just noticed).

@firefoxic
Copy link

It seems with Sass v1.63.4 release js api worked in this plugin, or not? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants