At-Rules
Much of Sass’s extra functionality comes in the form of new at-rules it adds on top of CSS:
-
@useloads mixins, functions, and variables from other Sass stylesheets, and combines CSS from multiple stylesheets together. -
@forwardloads a Sass stylesheet and makes its mixins, functions, and variables available when your stylesheet is loaded with the@userule. -
@importextends the CSS at-rule to load styles, mixins, functions, and variables from other stylesheets. -
@mixinand@includemakes it easy to re-use chunks of styles. -
@functiondefines custom functions that can be used in SassScript expressions. -
@extendallows selectors to inherit styles from one another. -
@at-rootputs styles within it at the root of the CSS document. -
@errorcauses compilation to fail with an error message. -
@warnprints a warning without stopping compilation entirely. -
@debugprints a message for debugging purposes. -
Flow control rules like
@if,@each,@for, and@whilecontrol whether or how many times styles are emitted.
Sass also has some special behavior for plain CSS at-rules: they can contain
interpolation, and they can be nested in style rules. Some of them, like
@media and @supports, also allow SassScript to be used directly in
the rule itself without interpolation.