ui icon indicating copy to clipboard operation
ui copied to clipboard

fix(cli): change the default path for tailwind globals css

Open lem0n4id opened this issue 1 year ago • 4 comments

Fixes shadcn-ui/ui#1821 Fixes shadcn-ui/ui#2302

TODO:

lem0n4id avatar Jan 06 '24 20:01 lem0n4id

@lem0n4id is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Jan 06 '24 20:01 vercel[bot]

Should i update the docs as well?

For example, in line 32 of nextjs docs :

- Where is your global CSS file? › › app/globals.css
+ Where is your global CSS file? › › src/app/globals.css

lem0n4id avatar Jan 06 '24 20:01 lem0n4id

@lem0n4id The thing is not all apps uses the src dir. I think a better fix would be to detect the src dir and add it to the suggested path. What do you think?

shadcn avatar Jan 07 '24 07:01 shadcn

@shadcn That makes perfect sense.

So would this work as the fix?

- export const DEFAULT_TAILWIND_CSS = "app/globals.css"
+ export const DEFAULT_TAILWIND_CSS = existsSync(path.resolve("./src")) ? "src/app/globals.css" : "app/globals.css"

lem0n4id avatar Jan 07 '24 19:01 lem0n4id

@lem0n4id We'll need to do this per framework-basis. Check out the example for Next.js here: https://github.com/shadcn-ui/ui/blob/main/packages/cli/src/utils/get-project-info.ts

(I'm going to close this for now since we need a different implementation but feel free to reopen if you have any questions. Thank you.)

shadcn avatar Jan 28 '24 09:01 shadcn