This is a fast-track proposal. Closes #3859
1.9 KiB
Unknown At-Rules
Syntax
In order to be flexible in its compatibility with future additions to CSS, Sass supports all at-rule names with a default syntax that's highly liberal in the structures it allows.
UnknownAtRule ::= '@' InterpolatedIdentifier InterpolatedValue? ('{' Statements '}')?
No whitespace is allowed after @
. As with all statements, an UnknownAtRule
without a block must be separated from other statements with a semicolon.
Semantics
To execute an unknown at-rule rule
:
-
Let
name
be the result of evaluatingrule
'sInterpolatedIdentifier
. -
Let
value
be the result of evaluatingrule
'sInterpolatedValue
, if it exists. -
Let
css
be a CSS unknown at-rule with namename
, valuevalue
, and with an empty list of children ifrule
hasStatements
. -
Let
parent
be the current style rule, keyframe block, or at-rule if one exists; or the innermost if multiple exist. -
If
rule
hasStatements
:-
If
parent
isn't set, appendcss
to the current module's CSS. -
Otherwise, if
parent
is a style rule:-
If
rule
's name is "font-face", or if its unprefixed name is "keyframes", appendcss
to the current module's CSS. -
Otherwise:
-
Append
css
toparent
's parent. -
Append a copy of
parent
without any children tocss
.This copy is now the current style rule until
rule
is done being executed.
-
-
-
Otherwise, append
css
toparent
. -
Evaluate each child in
rule
'sStatement
s.
-
-
Otherwise:
- Append
css
toparent
if it's set, or to the current module's CSS otherwise.
- Append