From a754b229cc461c41ef6dbd312a2fd7141d7cb38d Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 28 Jan 2026 19:42:49 +0100 Subject: [PATCH 1/4] add failing `var()` test --- src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 4b0b8539..9f5b11ef 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23101,6 +23101,14 @@ mod tests { minify_test(".foo { --test: .5s; }", ".foo{--test:.5s}"); minify_test(".foo { --theme-sizes-1\\/12: 2 }", ".foo{--theme-sizes-1\\/12:2}"); minify_test(".foo { --test: 0px; }", ".foo{--test:0px}"); + test( + ".foo { transform: var(--bar, ) }", + indoc! {r#" + .foo { + transform: var(--bar, ); + } + "#}, + ); // Test attr() function with type() syntax - minified minify_test( From a01c4eb844f2a4e52aefe218e57ffb93aa4843a3 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 28 Jan 2026 19:45:29 +0100 Subject: [PATCH 2/4] add failing `env()` test --- src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 9f5b11ef..0330a20d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23109,6 +23109,14 @@ mod tests { } "#}, ); + test( + ".foo { transform: env(--bar, ) }", + indoc! {r#" + .foo { + transform: env(--bar, ); + } + "#}, + ); // Test attr() function with type() syntax - minified minify_test( From 59db37e2255c6700ec682b0daf61af54265567fb Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 28 Jan 2026 19:47:27 +0100 Subject: [PATCH 3/4] fix `var()` whitespace handling --- src/properties/custom.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/properties/custom.rs b/src/properties/custom.rs index 2280b37f..ecef4ef5 100644 --- a/src/properties/custom.rs +++ b/src/properties/custom.rs @@ -1215,7 +1215,10 @@ impl<'i> Variable<'i> { dest.write_str("var(")?; self.name.to_css(dest)?; if let Some(fallback) = &self.fallback { - dest.delim(',', false)?; + dest.write_char(',')?; + if !fallback.starts_with_whitespace() { + dest.whitespace()?; + } fallback.to_css(dest, is_custom_property)?; } dest.write_char(')') From 64f7d1a6566b0da5213a05f72033c95f987510a7 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 28 Jan 2026 19:47:34 +0100 Subject: [PATCH 4/4] fix `env()` whitespace handling --- src/properties/custom.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/properties/custom.rs b/src/properties/custom.rs index ecef4ef5..9ffb838d 100644 --- a/src/properties/custom.rs +++ b/src/properties/custom.rs @@ -1392,7 +1392,10 @@ impl<'i> EnvironmentVariable<'i> { } if let Some(fallback) = &self.fallback { - dest.delim(',', false)?; + dest.write_char(',')?; + if !fallback.starts_with_whitespace() { + dest.whitespace()?; + } fallback.to_css(dest, is_custom_property)?; } dest.write_char(')')