dlmanning / gulp-sass

SASS plugin for gulp
MIT License
1.56k stars 381 forks source link

Migrate to the new dart-sass JavaScript API #837

Open cb-eli opened 2 years ago

cb-eli commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

I took the liberty of opening a PR @xzyfer

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

firefoxic commented 1 year ago

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