From 3c38f0a39144754f833eccef09e467e16e589988 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Wed, 14 Jun 2023 12:11:39 -0400 Subject: [PATCH] Expose theme variables to CSS --- src/lib/parseCssConfig.js | 3 ++- tests/css-configuration.test.js | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/parseCssConfig.js b/src/lib/parseCssConfig.js index 99a9acfd8..b218304f7 100644 --- a/src/lib/parseCssConfig.js +++ b/src/lib/parseCssConfig.js @@ -23,7 +23,8 @@ export function parseCssConfig(root) { } }) - theme.remove() + // Allow the variables to be used with var() anywhere in CSS + theme.selector = ':root' return config } diff --git a/tests/css-configuration.test.js b/tests/css-configuration.test.js index 470801809..9b25c2bbc 100644 --- a/tests/css-configuration.test.js +++ b/tests/css-configuration.test.js @@ -32,6 +32,9 @@ test('it does something', () => { --tw-text-opacity: 1; color: rgb(250 202 222 / var(--tw-text-opacity)); } + :root { + --colors-potato: #facade; + } `) }) })