compileAsync
- compile
Async(path:string,options?:Options<"async">):Promise<CompileResult> - Dart Sass
- since 1.45.0
- Node Sass
- ✗
Compatibility:Asynchronously compiles the Sass file at
path
toCSS. Returns a promisethat resolves with aCompileResult if it succeeds and rejects with anException if it fails.This only allows synchronous or asynchronousImporters andCustomFunctions.
⚠️ Heads up!
When using the
sass
npm package,compile is almosttwice as fast ascompileAsync, due to the overhead of making theentire evaluation process asynchronous.Example
constsass =require('sass');
constresult =awaitsass.compileAsync("style.scss");
console.log(result.css);Parameters
path:string
Optional
options:Options<"async">
ReturnsPromise<CompileResult>
- Defined injs-api-doc/compile.d.ts:194