Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]: [registry item] cssVars.theme will not add the variables under "@theme" in globals.css #7119

Open
2 tasks done
bogris opened this issue Apr 3, 2025 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@bogris
Copy link

bogris commented Apr 3, 2025

Describe the bug

I am writing a custom JSON that should add css variables for tailwind v4

using the "$schema": "https://ui.shadcn.com/schema/registry-item.json",
I am able to add light and dark variables, so this validates the cli config, globals.css finding, etc.

but the variables I define under css.Vars.theme have no effect.
To be even ore precise, running a JSON that has light / dark varaibles will output

{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "colors-blue",
  "type": "registry:style",
  "title": "test",
  "cssVars": {
    "theme inline": {
      "color-test": "var(--color2)"
    },
    "light": {
      "color-test": "colorLight"
    },
    "dark": {
      "color-test": "colorDark"
    }
  }
}
✔ Checking registry.
✔ Updating src/app/globals.css

but runnig a json only with theme:

{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "colors-blue",
  "type": "registry:style",
  "title": "test",
  "cssVars": {
    "theme inline": {
      "color-test": "var(--color2)"
    }
  }
}

will output:

✔ Checking registry.

it looks like the code is not triggered

Affected component/components

cli > add

How to reproduce

pnpm dlx create-next-app@latest
pnpm install tailwindcss @tailwindcss/postcss postcss
pnpm dlx shadcn@latest init
pnpm dlx shadcn@latest add http://localhost:3000/colors-blue.json

i have the json in my /public folder

Codesandbox/StackBlitz link

No response

Logs

System Info

MacOs 

packages installed are listed in the steps

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues
@bogris bogris added the bug Something isn't working label Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant