Sass Compilation
Main types for using the Sass compiler.
Topics
Compiler
actor Compiler
actor Compiler
A Sass compiler that uses Dart Sass as an embedded child process.
The Dart Sass compiler is bundled with this package for macOS and Ubuntu 64-bit Linux. For other platforms you need to supply this separately, see the readme.
Some debug logging is available via Compiler.logger
.
You must shut down the compiler using shutdownGracefully(...)
before the last reference
to the object is released otherwise the program will exit.
Custom importer resolution
Dart Sass uses a different algorithm to LibSass for processing imports. Each stylesheet is associated with the importer that loaded it – this may be an internal or hidden filesystem importer. Import resolution then goes:
- Consult the stylesheet’s associated importer.
- Consult every
DartSass.ImportResolver
given to the compiler, first the global list then the per-compilation list, in order within each list.
Declaration
public actor Compiler
Inputs
enum Syntax
enum Syntax
enum CssStyle
enum CssStyle
How the Sass compiler should format the CSS it produces.
Declaration
public enum CssStyle: Sendable
enum SourceMapStyle
enum SourceMapStyle
The kind of source map to generate for the stylesheet, returned in CompilerResults.sourceMap
.
Declaration
public enum SourceMapStyle: Sendable
enum CompilerMessageStyle
enum CompilerMessageStyle
The format used for CompilerError.description
and CompilerMessage.description
.
Declaration
public enum CompilerMessageStyle: Sendable
enum CompilerWarningLevel
enum CompilerWarningLevel
A control over warnings and debug messages produced by the compiler
Declaration
public enum CompilerWarningLevel: Sendable
Outputs
struct CompilerResults
struct CompilerResults
struct CompilerMessage
struct CompilerMessage
A diagnostic message generated by the Sass compiler that does not prevent the compilation from succeeding.
Appropriate for display to end users who own the stylesheets.
Declaration
public struct CompilerMessage: CustomStringConvertible, Sendable
struct CompilerError
struct CompilerError
Thrown as an error after a failed compilation.
Declaration
public struct CompilerError: Swift.Error, CustomStringConvertible, Sendable
struct Span
struct Span