diff --git a/src/css.rs b/src/css.rs index 7022ac9..969cd03 100644 --- a/src/css.rs +++ b/src/css.rs @@ -134,7 +134,11 @@ impl Css { } Toplevel::AtRule(r) => match r { 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())) .pretty_print(buf, nesting + 1) .unwrap(); diff --git a/tests/media.rs b/tests/media.rs index 6d395f8..f9320fe 100644 --- a/tests/media.rs +++ b/tests/media.rs @@ -7,6 +7,10 @@ test!( basic_toplevel, "@media foo {\n a {\n color: red;\n }\n}\n" ); +test!( + toplevel_no_params, + "@media {\n a {\n color: red;\n }\n}\n" +); test!( basic_nested, "a {\n @media foo {\n color: red;\n }\n}\n",