-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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 Sass Compiler API #14689
Comments
Thank you! As the proposed API only supports the modern API, Vite needs to migrate to modern API first (#7116). Other than that, I guess the proposed API work for us. |
Proposal -- do what sass-loader did (webpack-contrib/sass-loader#774). Create an 'api' flag on the options that lets uses opt-in to use the modern API, while still maintaining 100% backwards compatibility with others. Could be as simple as this in the config:
Cutdown code will look something like this:
|
Description
We (the Sass team) have just released a proposal for a
Compiler
API in Sass that shares resources between different compilations (see also sass/sass#3296). This is particularly useful when using thesass-embedded
package, which runs a very fast subprocess to compile Sass: within the lifetime of a singleCompiler
, the subprocess will remain open, eliminating all the overhead of starting it and shutting it down that currently causessass-embedded
to be slower than it could be.For now, we're just seeking your feedback on the proposal. Once it lands, we hope you'll integrate it into Vite for substantially improved performance.
Suggested solution
Start a
Compiler
when Vite's build initializes and uses that compiler to compile all Sass files, so that Sass users using the embedded host experience better performance.Alternative
Runs a separate
sass.compile()
call for each compilation, which has a large amount of overhead when using sass-embedded.Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: