compile function

  1. @Deprecated("Use compileToResult() instead.")
String compile(
  1. String path, {
  2. bool color = false,
  3. Logger? logger,
  4. Iterable<Importer>? importers,
  5. Iterable<String>? loadPaths,
  6. PackageConfig? packageConfig,
  7. Iterable<Callable>? functions,
  8. OutputStyle? style,
  9. bool quietDeps = false,
  10. bool verbose = false,
  11. @Deprecated("Use CompileResult.sourceMap from compileToResult() instead.") void sourceMap(
    1. SingleMapping map
    )?,
  12. bool charset = true,
})

Like compileToResult, but returns CompileResult.css rather than returning CompileResult directly.

If sourceMap is passed, it's passed a SingleMapping that indicates which sections of the source file(s) correspond to which in the resulting CSS. It's called immediately before this method returns, and only if compilation succeeds. Note that SingleMapping.targetUrl will always be null. Users using the SingleMapping API should be sure to add the source_maps package to their pubspec.

This parameter is meant to be used as an out parameter, so that users who want access to the source map can get it. For example:

SingleMapping sourceMap;
var css = compile(sassPath, sourceMap: (map) => sourceMap = map);

Implementation

@Deprecated("Use compileToResult() instead.")
String compile(String path,
    {bool color = false,
    Logger? logger,
    Iterable<Importer>? importers,
    Iterable<String>? loadPaths,
    PackageConfig? packageConfig,
    Iterable<Callable>? functions,
    OutputStyle? style,
    bool quietDeps = false,
    bool verbose = false,
    @Deprecated("Use CompileResult.sourceMap from compileToResult() instead.")
    void sourceMap(SingleMapping map)?,
    bool charset = true}) {
  var result = compileToResult(path,
      logger: logger,
      importers: importers,
      loadPaths: loadPaths,
      packageConfig: packageConfig,
      functions: functions,
      style: style,
      quietDeps: quietDeps,
      verbose: verbose,
      sourceMap: sourceMap != null,
      charset: charset);
  result.sourceMap.andThen(sourceMap);
  return result.css;
}