Skip to content

Commit 6efa74d

Browse files
authored
fix: Missing semicolon in Custom Media Queries (parcel-bundler#260)
1 parent dc9c59e commit 6efa74d

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/rules/custom_media.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ impl<'i> ToCss for CustomMediaRule<'i> {
2929
dest.write_str("@custom-media ")?;
3030
self.name.to_css(dest)?;
3131
dest.write_char(' ')?;
32-
self.query.to_css(dest)
32+
self.query.to_css(dest)?;
33+
dest.write_char(';')
3334
}
3435
}

tests/cli_integration_tests.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,3 +366,22 @@ fn targets() -> Result<(), Box<dyn std::error::Error>> {
366366

367367
Ok(())
368368
}
369+
370+
#[test]
371+
fn preserve_custom_media() -> Result<(), Box<dyn std::error::Error>> {
372+
let file = assert_fs::NamedTempFile::new("test.css")?;
373+
file.write_str(
374+
r#"
375+
@custom-media --foo print;
376+
"#,
377+
)?;
378+
379+
let mut cmd = Command::cargo_bin("parcel_css")?;
380+
cmd.arg(file.path());
381+
cmd.arg("--custom-media");
382+
cmd.assert().success().stdout(predicate::str::contains(indoc! {r#"
383+
@custom-media --foo print;
384+
"#}));
385+
386+
Ok(())
387+
}

0 commit comments

Comments
 (0)