Correctly print whitespace when no params in at rule
This commit is contained in:
parent
260b357bba
commit
bf0ce2fe1a
@ -134,7 +134,11 @@ impl Css {
|
|||||||
}
|
}
|
||||||
Toplevel::AtRule(r) => match r {
|
Toplevel::AtRule(r) => match r {
|
||||||
AtRule::Unknown(u) => {
|
AtRule::Unknown(u) => {
|
||||||
writeln!(buf, "{}@{} {} {{", padding, u.name, u.params)?;
|
if u.params.is_empty() {
|
||||||
|
writeln!(buf, "{}@{} {{", padding, u.name)?;
|
||||||
|
} else {
|
||||||
|
writeln!(buf, "{}@{} {} {{", padding, u.name, u.params)?;
|
||||||
|
}
|
||||||
Css::from_stylesheet(StyleSheet::from_stmts(u.body.clone()))
|
Css::from_stylesheet(StyleSheet::from_stmts(u.body.clone()))
|
||||||
.pretty_print(buf, nesting + 1)
|
.pretty_print(buf, nesting + 1)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -7,6 +7,10 @@ test!(
|
|||||||
basic_toplevel,
|
basic_toplevel,
|
||||||
"@media foo {\n a {\n color: red;\n }\n}\n"
|
"@media foo {\n a {\n color: red;\n }\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
toplevel_no_params,
|
||||||
|
"@media {\n a {\n color: red;\n }\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
basic_nested,
|
basic_nested,
|
||||||
"a {\n @media foo {\n color: red;\n }\n}\n",
|
"a {\n @media foo {\n color: red;\n }\n}\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user