Remove fallbacks from theme var(...) calls (#14881)

This PR changes how we render `var(...)` calls for theme values,
removing the fallback values we were previously including.

```diff
  .text-white {
-   color: var(--color-white, #fff);
+   color: var(--color-white);
  }
```

We previously included the fallbacks only so you could see the value in
dev tools but this feels like a bad reason to bloat the CSS. I'd rather
just convince the Chrome team to surface this stuff better in dev tools
in the first place.

---------

Co-authored-by: Adam Wathan <[email protected]>
This commit is contained in:
Adam Wathan
2024-11-05 15:44:21 -05:00
committed by GitHub
co-authored by Adam Wathan
parent bf2189eded
commit 4e357caccb
14 changed files with 478 additions and 477 deletions
@@ -541,12 +541,12 @@ exports[`\`@import 'tailwindcss'\` is replaced with the generated CSS 1`] = `
@layer utilities {
.text-2xl {
font-size: var(--font-size-2xl, 1.5rem);
line-height: var(--tw-leading, var(--font-size-2xl--line-height, 2rem));
font-size: var(--font-size-2xl);
line-height: var(--tw-leading, var(--font-size-2xl--line-height));
}
.text-black\\/50 {
color: color-mix(in oklch, var(--color-black, #000) 50%, transparent);
color: color-mix(in oklch, var(--color-black) 50%, transparent);
}
.underline {
@@ -100,7 +100,7 @@ test('@apply can be used without emitting the theme in the CSS file', async () =
expect(result.css.trim()).toMatchInlineSnapshot(`
".foo {
color: var(--color-red-500, oklch(.637 .237 25.331));
color: var(--color-red-500);
}"
`)
})