From f463878ecb913b0d1830cf0d4e1a067df681e791 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Fri, 26 Jul 2024 16:02:21 -0400 Subject: [PATCH] =?UTF-8?q?Allow=20passing=20CSS=20properties=20to=20`them?= =?UTF-8?q?e(=E2=80=A6)`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/tailwindcss/src/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/tailwindcss/src/index.ts b/packages/tailwindcss/src/index.ts index 3b536e085..a9f1b69d8 100644 --- a/packages/tailwindcss/src/index.ts +++ b/packages/tailwindcss/src/index.ts @@ -466,6 +466,14 @@ export function compile( }, theme(path: string, fallback?: any) { + if (path.startsWith('--')) { + if (path.endsWith('-*')) { + return Object.fromEntries(theme.namespace(path.slice(0, -2) as any).entries()) + } + + return theme.resolveValue(null, [path] as any) ?? fallback ?? null + } + path = path // Escape dots used inside square brackets .replace(/\[(.*?)\]/g, (_, value) => `-${value.replace('.', '_')}`)