glromeo / esbuild-sass-plugin

esbuild plugin for sass
MIT License
155 stars 40 forks source link

Option to use sass-embedded #124

Closed stoivo closed 1 year ago

stoivo commented 1 year ago

In package.json you are depending on sass https://github.com/glromeo/esbuild-sass-plugin/blob/main/package.json#L59

If I understand this correctly this is the dart-sass complier compiled into javascript. I wonder if there is any reason why you don't use sass-embedded instead https://www.npmjs.com/package/sass-embedded. It includes the sass binary compiled from the same dart-sass project. It is up to 10 times faster, mostly faster than libsass even.

I am looking at moving some scss files into esbuild but I don't want to wait for slow compilers when there are options :)

I would be okay we leaving the default sass but I want an option to go for sass-embedded.

glromeo commented 1 year ago

It is up to 10 times faster, mostly faster than libsass even.

That statement might be true but the sass embedded is greatly penalised by being called repeatedly during a build so end up being slower because the integration overhead is the bottleneck (and I say that because I did a spike some time ago and the results were pretty poor).

To make it optional would pollute the plugin so I am not interested in going down this route

stoivo commented 1 year ago

Interesting, I would be very interested in seeing these benchmarks and maybe bring up this up as an issue to the dart-sass team, if they did not already know it. (Sorry for opening the issue and not searching through closed issues, sorry.) I can see that it might be slower to convert small files with sass-embedded, but in our application we bundle all of our assets into 3 different entripoints, so the story might be a bit different on out side.

Althoug if you sent time invertigating this years ago I get it that it might not be so interesting looking into again.
Maybe you can add sentence onder Benchmarks in the readme?

glromeo commented 1 year ago

I suggest you try esbuild-plugin-sass or try and fork this plugin and replace sass with the embedded. Best of luck