-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
What version of Tailwind CSS are you using?
v4.1.11
What build tool (or framework if it abstracts the build tool) are you using?
webpack
What version of Node.js are you using?
v20.18.3
What browser are you using?
Chrome
What operating system are you using?
Windows
Reproduction URL
https://play.tailwindcss.com/be7vc5mYw8?file=css
Describe your issue
When using @import "tailwindcss" prefix(tw);
, custom theme variables (e.g., --btn-color
) inside a utility class (e.g., .btn
) don't resolve correctly. The background color doesn't apply, and using var(--btn-color)
breaks due to the prefix. The theme()
function is deprecated and doesn't work in this case.
Steps to Reproduce:
- Define a custom theme variable
--btn-color
. - Create a utility class that references
var(--btn-color)
. - Add
prefix(tw)
to the Tailwind setup. - Apply the class
tw:btn
to an element.
Expected Behavior:
The button background should be the custom theme color --btn-color
(red).
Actual Behavior:
The background color doesn't apply, and var(--btn-color)
doesn’t work with the prefixed class.
Suggested Fix:
Ensure custom theme variables work correctly with prefixed class names