When using the sass-embedded npm package for single
compilations, compileAsync is almost always faster than
compile, due to the overhead of emulating synchronous messaging
with worker threads and concurrent compilations being blocked on mainthread.
If you are running multiple compilations with the sass-embedded npm
package, using a Compiler will provide some speed improvements over
the module-level methods, and an AsyncCompiler will be muchfaster.
Synchronously compiles the Sass file at
path
to CSS. If it succeeds it returns a CompileResult, and if it fails it throws an Exception.This only allows synchronous Importers and CustomFunctions.
⚠️ Heads up!
When using the sass-embedded npm package for single compilations, compileAsync is almost always faster than compile, due to the overhead of emulating synchronous messaging with worker threads and concurrent compilations being blocked on main thread.
If you are running multiple compilations with the sass-embedded npm package, using a Compiler will provide some speed improvements over the module-level methods, and an AsyncCompiler will be much faster.
Example