compileString function
- @Deprecated("Use compileStringToResult() instead.")
- String source, {
- Syntax? syntax,
- bool color = false,
- Logger? logger,
- Iterable<
Importer> ? importers, - PackageConfig? packageConfig,
- Iterable<
String> ? loadPaths, - Iterable<
Callable> ? functions, - OutputStyle? style,
- Importer? importer,
- Object? url,
- bool quietDeps = false,
- bool verbose = false,
- @Deprecated("Use CompileResult.sourceMap from compileStringToResult() instead.") void sourceMap(
- SingleMapping map
- bool charset = true,
- @Deprecated("Use syntax instead.") bool indented = false,
Like compileStringToResult, 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 = compileString(sass, sourceMap: (map) => sourceMap = map);
Implementation
@Deprecated("Use compileStringToResult() instead.")
String compileString(String source,
{Syntax? syntax,
bool color = false,
Logger? logger,
Iterable<Importer>? importers,
PackageConfig? packageConfig,
Iterable<String>? loadPaths,
Iterable<Callable>? functions,
OutputStyle? style,
Importer? importer,
Object? url,
bool quietDeps = false,
bool verbose = false,
@Deprecated(
"Use CompileResult.sourceMap from compileStringToResult() instead.")
void sourceMap(SingleMapping map)?,
bool charset = true,
@Deprecated("Use syntax instead.") bool indented = false}) {
var result = compileStringToResult(source,
syntax: syntax ?? (indented ? Syntax.sass : Syntax.scss),
logger: logger,
importers: importers,
packageConfig: packageConfig,
loadPaths: loadPaths,
functions: functions,
style: style,
importer: importer,
url: url,
quietDeps: quietDeps,
verbose: verbose,
sourceMap: sourceMap != null,
charset: charset);
result.sourceMap.andThen(sourceMap);
return result.css;
}