diff --git a/crates/mako/src/visitors/css_assets.rs b/crates/mako/src/visitors/css_assets.rs index c5523ea0c..7066e4f04 100644 --- a/crates/mako/src/visitors/css_assets.rs +++ b/crates/mako/src/visitors/css_assets.rs @@ -28,14 +28,12 @@ impl VisitMut for CSSAssets { box UrlValue::Raw(s) => s.value.to_string(), }; - if is_remote_or_data_or_hash(&url) { + if is_remote_or_data_or_hash(&url) || url.is_empty() { return; } + let url = remove_first_tilde(url); - if url.is_empty() { - return; - } let dep = Dependency { source: url, resolve_as: None, @@ -114,6 +112,14 @@ mod tests { ); } + #[test] + fn test_empty_url() { + assert_eq!( + run(r#".foo { background: url("") }"#), + r#".foo{background:url("")}"# + ); + } + #[test] fn test_big_image() { assert!(run(r#".foo { background: url(big.jpg) }"#).contains(".foo{background:url(big."));