compileAsync function

Future<String> compileAsync (String path, { bool color: false, Logger logger, Iterable<AsyncImporter> importers, SyncPackageResolver packageResolver, Iterable<String> loadPaths, Iterable<AsyncCallable> functions, OutputStyle style, void sourceMap(SingleMapping map) })

Like compile, except it runs asynchronously.

Running asynchronously allows this to take AsyncImporters rather than synchronous Importers. However, running asynchronously is also somewhat slower, so compile should be preferred if possible.

Implementation

Future<String> compileAsync(String path,
    {bool color = false,
    Logger logger,
    Iterable<AsyncImporter> importers,
    SyncPackageResolver packageResolver,
    Iterable<String> loadPaths,
    Iterable<AsyncCallable> functions,
    OutputStyle style,
    void sourceMap(SingleMapping map)}) async {
  var result = await c.compileAsync(path,
      logger: logger ?? Logger.stderr(color: color),
      importers: importers,
      loadPaths: loadPaths,
      packageResolver: packageResolver,
      functions: functions,
      style: style,
      sourceMap: sourceMap != null);
  if (sourceMap != null) sourceMap(result.sourceMap);
  return result.css;
}