sass_api library
We strongly recommend importing this library with the prefix sass
.
Classes
- Argument
- An argument declared as part of an ArgumentDeclaration.
- ArgumentDeclaration
- An argument declaration, as for a function or mixin definition.
- ArgumentInvocation
- A set of arguments passed in to a function or mixin.
- AstNode
- A node in an abstract syntax tree.
- AsyncCallable
- An interface for functions and mixins that can be invoked from Sass by passing in arguments.
- AsyncImportCache
- An in-memory cache of parsed stylesheets that have been imported by Sass.
- AsyncImporter
-
An interface for importers that resolves URLs in
@import
s to the contents of Sass files. - AtRootRule
-
An
@at-root
rule. - AtRule
- An unknown at-rule.
- AttributeSelector
- An attribute selector.
- BinaryOperationExpression
-
A binary operator, as in
1 + 2
or$this and $other
. - BooleanExpression
-
A boolean literal,
true
orfalse
. - CalculationInterpolation
- A deprecated representation of a string injected into a SassCalculation using interpolation.
- CalculationOperation
- A binary operation that can appear in a SassCalculation.
- Callable
- An interface for functions and mixins that can be invoked from Sass by passing in arguments.
- CallableDeclaration
- An abstract class for callables (functions or mixins) that are declared in user code.
- CallableInvocation
- An abstract class for invoking a callable (a function or mixin).
- ClassSelector
- A class selector.
- ColorChannel
- Metadata about a single channel in a known color space.
- ColorExpression
- A color literal.
- ColorSpace
- A color space whose channel names and semantics Sass knows.
- CompileResult
- The result of compiling a Sass document to CSS, along with metadata about the compilation process.
- ComplexSelector
- A complex selector.
- ComplexSelectorComponent
- A component of a ComplexSelector.
- CompoundSelector
- A compound selector.
- ConfiguredVariable
-
A variable configured by a
with
clause in a@use
or@forward
rule. - ContentBlock
- An anonymous block of code that's invoked for a ContentRule.
- ContentRule
-
A
@content
rule. - DebugRule
-
A
@debug
rule. - Declaration
-
A declaration (that is, a
name: value
pair). - DependencyReport
- A struct of different types of dependencies a Sass stylesheet can contain.
- DynamicImport
- An import that will load a Sass file at runtime.
- EachRule
-
An
@each
rule. - ElseClause
-
An
@else
clause in an@if
rule. - ErrorRule
-
An
@error
rule. - Expression
- A SassScript expression in a Sass syntax tree.
-
ExpressionVisitor<
T> - An interface for visitors that traverse SassScript expressions.
- ExtendRule
-
An
@extend
rule. - FilesystemImporter
-
An importer that loads files from a load path on the filesystem, either
relative to the path passed to FilesystemImporter.new or absolute
file:
URLs. - ForRule
-
A
@for
rule. - ForwardRule
-
A
@forward
rule. - FunctionExpression
- A function invocation.
- FunctionRule
- A function declaration.
- GamutMapMethod
- Different algorithms that can be used to map an out-of-gamut Sass color into the gamut for its color space.
- IDSelector
- An ID selector.
- IfClause
-
An
@if
or@else if
clause in an@if
rule. - IfExpression
- A ternary expression.
- IfRule
-
An
@if
rule. - IfRuleClause
-
The superclass of
@if
and@else
clauses. - Import
- An abstract superclass for different types of import.
- ImportCache
- An in-memory cache of parsed stylesheets that have been imported by Sass.
- Importer
-
An interface for importers that resolves URLs in
@import
s to the contents of Sass files. - ImporterResult
- The result of importing a Sass stylesheet, as returned by Importer.load.
- ImportRule
-
An
@import
rule. - IncludeRule
- A mixin invocation.
- InterpolatedFunctionExpression
- An interpolated function invocation.
- Interpolation
- Plain text interpolated with Sass expressions.
- InterpolationMap
- A map from locations in a string generated from an Interpolation to the original source code in the interpolation.
- InterpolationMethod
- The method by which two colors are interpolated to find a color in the middle.
- LinearChannel
- Metadata about a color channel with a linear (as opposed to polar) value.
- ListExpression
- A list literal.
- Logger
- An interface for loggers that print messages produced by Sass stylesheets.
- LoudComment
- A loud CSS-style comment.
- MapExpression
- A map literal.
- MediaRule
-
A
@media
rule. - MixinRule
- A mixin declaration.
- NullExpression
- A null literal.
- NumberExpression
- A number literal.
- PackageImporter
-
An importer that loads stylesheets from
package:
imports. - ParenthesizedExpression
- An expression wrapped in parentheses.
- ParentSelector
- A selector that matches the parent in the Sass stylesheet.
-
ParentStatement<
T extends List< Statement> ?> - A Statement that can have child statements.
- PlaceholderSelector
- A placeholder selector.
- PseudoSelector
- A pseudo-class or pseudo-element selector.
- QualifiedName
- A qualified name.
- ReturnRule
-
A
@return
rule. - SassArgumentList
- A SassScript argument list.
- SassBoolean
- A SassScript boolean value.
- SassCalculation
- A SassScript calculation.
- SassColor
- A SassScript color.
- SassDeclaration
- A common interface for any node that declares a Sass member.
- SassDependency
- A common interface for UseRules, ForwardRules, and DynamicImports.
- SassFunction
- A SassScript function reference.
- SassList
- A SassScript list.
- SassMap
- A SassScript map.
- SassMixin
- A SassScript mixin reference.
- SassNode
- A node in the abstract syntax tree for an unevaluated Sass or SCSS file.
- SassNumber
- A SassScript number.
- SassReference
- A common interface for any node that references a Sass member.
- SassString
- A SassScript string.
- Selector
- A node in the abstract syntax tree for a selector.
- SelectorExpression
-
A parent selector reference,
&
. - SelectorList
- A selector list.
-
SelectorVisitor<
T> - An interface for visitors that traverse selectors.
- SilentComment
- A silent Sass-style comment.
- SimpleSelector
- An abstract superclass for simple selectors.
- Statement
- A statement in a Sass syntax tree.
-
StatementVisitor<
T> - An interface for visitors that traverse Sass statements.
- StaticImport
-
An import that produces a plain CSS
@import
rule. - StringExpression
- A string literal.
- StyleRule
- A style rule.
- Stylesheet
- A Sass stylesheet.
- SupportsAnything
-
A supports condition that represents the forwards-compatible
<general-enclosed>
production. - SupportsCondition
-
An abstract class for defining the condition a
@supports
rule selects. - SupportsDeclaration
- A condition that selects for browsers where a given declaration is supported.
- SupportsExpression
-
An expression-level
@supports
condition. - SupportsFunction
- A function-syntax condition.
- SupportsInterpolation
- An interpolated condition.
- SupportsNegation
- A negated condition.
- SupportsOperation
- An operation defining the relationship between two conditions.
- SupportsRule
-
A
@supports
rule. - TypeSelector
- A type selector.
- UnaryOperationExpression
-
A unary operator, as in
+$var
ornot fn()
. - UniversalSelector
- Matches any element in the given namespace.
- UseRule
-
A
@use
rule. - Value
- A SassScript value.
- ValueExpression
- An expression that directly embeds a Value.
- VariableDeclaration
- A variable declaration.
- VariableExpression
- A Sass variable.
- WarnRule
-
A
@warn
rule. - WhileRule
-
A
@while
rule.
Enums
- AttributeOperator
- An operator that defines the semantics of an AttributeSelector.
- BinaryOperator
- A binary operator constant.
- CalculationOperator
- An enumeration of possible operators for CalculationOperation.
- Combinator
- A combinator that defines the relationship between selectors in a ComplexSelector.
- Deprecation
- A deprecated feature in the language.
- HueInterpolationMethod
- The method by which two hues are adjusted when interpolating between colors.
- ListSeparator
- An enum of list separator types.
- OutputStyle
- An enum of generated CSS styles.
- Syntax
- An enum of syntaxes that Sass can parse.
- UnaryOperator
- A unary operator constant.
Mixins
-
AstSearchVisitor<
T> -
A visitor that recursively traverses each statement and expression in a Sass
AST whose
visit*
methods default to returningnull
, but which returns the first non-null
value returned by any method. - RecursiveAstVisitor
- A visitor that recursively traverses each statement and expression in a Sass AST.
- RecursiveSelectorVisitor
- A visitor that recursively traverses each component of a Selector AST.
- RecursiveStatementVisitor
- A visitor that recursively traverses each statement in a Sass AST.
- ReplaceExpressionVisitor
- A visitor that recursively traverses each expression in a SassScript AST and replaces its contents with the values returned by nested recursion.
-
SelectorSearchVisitor<
T> -
A SelectorVisitor whose
visit*
methods default to returningnull
, but which returns the first non-null
value returned by any method. -
StatementSearchVisitor<
T> -
A StatementVisitor whose
visit*
methods default to returningnull
, but which returns the first non-null
value returned by any method.
Extensions
- SassApiColorSpace on ColorSpace
-
ColorSpace methods that are only visible through the
sass_api
package. - SassApiValue on Value
-
Extension methods that are only visible through the
sass_api
package.
Constants
- sassFalse → const SassBoolean Value
-
The SassScript
false
value. - sassNull → const Value Value
-
The SassScript
null
value. - sassTrue → const SassBoolean Value
-
The SassScript
true
value.
Functions
-
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, void sourceMap(SingleMapping map)?, bool charset = true}) → String - Like compileToResult, but returns CompileResult.css rather than returning CompileResult directly.
-
compileAsync(
String path, {bool color = false, Logger? logger, Iterable< AsyncImporter> ? importers, PackageConfig? packageConfig, Iterable<String> ? loadPaths, Iterable<AsyncCallable> ? functions, OutputStyle? style, bool quietDeps = false, bool verbose = false, void sourceMap(SingleMapping map)?}) → Future<String> - Like compile, except it runs asynchronously.
-
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, void sourceMap(SingleMapping map)?, bool charset = true, bool indented = false}) → String - Like compileStringToResult, but returns CompileResult.css rather than returning CompileResult directly.
-
compileStringAsync(
String source, {Syntax? syntax, bool color = false, Logger? logger, Iterable< AsyncImporter> ? importers, PackageConfig? packageConfig, Iterable<String> ? loadPaths, Iterable<AsyncCallable> ? functions, OutputStyle? style, AsyncImporter? importer, Object? url, bool quietDeps = false, bool verbose = false, void sourceMap(SingleMapping map)?, bool charset = true, bool indented = false}) → Future<String> - Like compileString, except it runs asynchronously.
-
compileStringToResult(
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, bool sourceMap = false, bool charset = true, Iterable<Deprecation> ? silenceDeprecations, Iterable<Deprecation> ? fatalDeprecations, Iterable<Deprecation> ? futureDeprecations}) → CompileResult -
Compiles
source
to CSS and returns a CompileResult containing the CSS and additional metadata about the compilation.. -
compileStringToResultAsync(
String source, {Syntax? syntax, bool color = false, Logger? logger, Iterable< AsyncImporter> ? importers, PackageConfig? packageConfig, Iterable<String> ? loadPaths, Iterable<AsyncCallable> ? functions, OutputStyle? style, AsyncImporter? importer, Object? url, bool quietDeps = false, bool verbose = false, bool sourceMap = false, bool charset = true, Iterable<Deprecation> ? silenceDeprecations, Iterable<Deprecation> ? fatalDeprecations, Iterable<Deprecation> ? futureDeprecations}) → Future<CompileResult> - Like compileStringToResult, except it runs asynchronously.
-
compileToResult(
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, bool sourceMap = false, bool charset = true, Iterable<Deprecation> ? silenceDeprecations, Iterable<Deprecation> ? fatalDeprecations, Iterable<Deprecation> ? futureDeprecations}) → CompileResult -
Loads the Sass file at
path
, compiles it to CSS, and returns a CompileResult containing the CSS and additional metadata about the compilation. -
compileToResultAsync(
String path, {bool color = false, Logger? logger, Iterable< AsyncImporter> ? importers, PackageConfig? packageConfig, Iterable<String> ? loadPaths, Iterable<AsyncCallable> ? functions, OutputStyle? style, bool quietDeps = false, bool verbose = false, bool sourceMap = false, bool charset = true, Iterable<Deprecation> ? silenceDeprecations, Iterable<Deprecation> ? fatalDeprecations, Iterable<Deprecation> ? futureDeprecations}) → Future<CompileResult> - Like compileToResult, except it runs asynchronously.
-
fakeFromImport<
T> (T callback()) → T -
Runs
callback
in a context where AsyncImporter.fromImport returnstrue
. -
findDependencies(
Stylesheet stylesheet) → DependencyReport -
Returns
stylesheet
's statically-declared dependencies. -
isIdentifier(
String text) → bool Parsing -
Returns whether
text
is a valid CSS identifier. -
parseIdentifier(
String text) → String Parsing -
Parses
text
as a CSS identifier and returns the result. -
warn(
String message, {bool deprecation = false}) → void -
Prints a warning message associated with the current
@import
or function call.
Typedefs
- AsyncCanonicalizeResult = (AsyncImporter, Uri, {Uri originalUrl})
- A canonicalized URL and the importer that canonicalized it.
- CanonicalizeResult = (Importer, Uri, {Uri originalUrl})
- A canonicalized URL and the importer that canonicalized it.
Exceptions / Errors
- SassException
- An exception thrown by Sass.
- SassFormatException
- An exception thrown when Sass parsing has failed.