Handle toplevel @include

This commit is contained in:
ConnorSkees 2020-01-26 17:28:39 -05:00
parent 934f9d860d
commit 1761af0a01
2 changed files with 8 additions and 0 deletions

View File

@ -361,6 +361,9 @@ impl<'a> StyleSheetParser<'a> {
};
rules.push(Stmt::MultilineComment(comment));
}
TokenKind::AtRule(AtRuleKind::Include) => {
rules.extend(eat_include(&mut self.lexer, &self.global_scope, &Selector(Vec::new())).unwrap_or_else(|e| self.error(e.0, &e.1)))
}
TokenKind::AtRule(AtRuleKind::Import) => {
let Token { pos, .. } = self
.lexer

View File

@ -664,6 +664,11 @@ mod test_mixins {
"@mixin a($a) {\n color: $a;\n}\nd {\n @include a($a/*foo*/: red);\n}\n",
"d {\n color: red;\n}\n"
);
test!(
toplevel_include,
"@mixin a {\n a {\n color: red;\n }\n}\n\n@include a;\n",
"a {\n color: red;\n}\n"
);
}
#[cfg(test)]