Skip to content

CSS variables created by plugins are modified #16100

Closed
@siriwatknp

Description

@siriwatknp

What version of Tailwind CSS are you using?

v4.0.1

What operating system are you using?

macOS

Reproduction URL

  • Pull tailwindcss project
  • Add the test below to packages/tailwindcss/src/plugin.test.ts
diff --git a/packages/tailwindcss/src/plugin.test.ts b/packages/tailwindcss/src/plugin.test.ts
index 9af3a55f..89129df7 100644
--- a/packages/tailwindcss/src/plugin.test.ts
+++ b/packages/tailwindcss/src/plugin.test.ts
@@ -32,6 +32,36 @@ test('plugin', async () => {
   `)
 })
 
+test('plugin CSS variables', async () => {
+  let input = css`
+    @plugin "my-plugin";
+  `
+
+  let compiler = await compile(input, {
+    loadModule: async () => ({
+      module: plugin(function ({ addBase }) {
+        addBase({
+          body: {
+            '--jun-drawerOpen': '1',
+            '--jun-ES-drawerWidth': '18rem',
+          },
+        })
+      }),
+      base: '/root',
+    }),
+  })
+
+  expect(compiler.build([])).toMatchInlineSnapshot(`
+    "@layer base {
+      body {
+        --jun-drawerOpen: 1;
+        --jun-ES-drawerWidth: 18rem;
+      }
+    }
+    "
+  `)
+})
+
 test('plugin.withOptions', async () => {
   let input = css`
     @plugin "my-plugin";

Run the test to see the error:

Image

Describe your issue

Tailwind CSS should not modify the CSS variables created by plugins.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions