farm-fe / farm

Extremely fast Vite-compatible web build tool written in Rust
https://farmfe.org
MIT License
4.95k stars 163 forks source link

[Feature] Use `grass` as the replacement of `dart-sass` in rust plugin `sass` #278

Open llc1123 opened 1 year ago

llc1123 commented 1 year ago

What problem does this feature solve?

There is a pure rust implementation of sass which could be a drop-in replacement of dart-sass. And it is much faster.

As we are introducing rust plugins in farm, I think it could be better and more elegant getting rid of dart-sass-embedded.

What does the proposed API look like?

Just keep it the same as the current sass plugin.

wre232114 commented 1 year ago

As I know, sass-embedded is more stable that grass, grass misses many features. And the performance is the same.

We will try grass later, contributions are also welcome, thanks!

llc1123 commented 1 year ago

As I know, sass-embedded is more stable that grass

Yes, sass-embedded is more stable.

grass misses many features

No, grass is currently having almost every feature of dart-sass. Only several edge cases are not covered, which already meets most use cases.

And the performance is the same.

I didn't do the benchmark, but according to the README of the project, grass is ~2x faster than dart-sass.

On another side, just like farm, frontend toolchain projects based on rust need more collaboration to make them widely adopted.

wre232114 commented 1 year ago

We tried grass last year, and it fails for many projects that we try to migrate, so we switch to dart-sass-embedded, and we also do the benchmark too, the result is close. We will try grass next month, hope that it becomes more reliable!

And yes, we are really glad to make everything in Rust!