ui icon indicating copy to clipboard operation
ui copied to clipboard

Command is not working with t3 app

Open FleetAdmiralJakob opened this issue 1 year ago • 7 comments

The command pnpm dlx shadcn-ui init does not work with the t3 app (already included there tailwind)

FleetAdmiralJakob avatar May 21 '23 17:05 FleetAdmiralJakob

pnpm create t3-app@latest # tailwind selected
cd my-t3-app
pnpm dlx shadcn-ui init
pnpm run dev

Running the above commands seems to work as expected. Can you elaborate on what doesn't work?

ap-1 avatar May 21 '23 21:05 ap-1

Two things:

~~- shadcn/ui not recognizes that T3 uses an src directory~~ fixed because of the new CLI

  • and it does not recognize that T3 uses typescript syntax for the tailwind config file

FleetAdmiralJakob avatar May 22 '23 05:05 FleetAdmiralJakob

And btw.: the tailwind styles are also not working anymore

FleetAdmiralJakob avatar May 22 '23 06:05 FleetAdmiralJakob

@FleetAdmiralJakob We're working on adding out of the box support for t3. For now, it requires manual installation. I'll see if I can find an example repo and share.

shadcn avatar May 22 '23 07:05 shadcn

@FleetAdmiralJakob Here's an example repo from @juliusmarminge https://github.com/juliusmarminge/t3-complete

shadcn avatar May 22 '23 07:05 shadcn

@FleetAdmiralJakob Here's an example repo from @juliusmarminge juliusmarminge/t3-complete

Great! Copied the code from that and it worked.

@FleetAdmiralJakob We're working on adding out of the box support for t3. For now, it requires manual installation. I'll see if I can find an example repo and share.

Cool, I think that would be a really cool addition, especially if I'm right and the problems are general problems (.ts and src directory)

FleetAdmiralJakob avatar May 22 '23 11:05 FleetAdmiralJakob

It seems that most of the issues have been resolved with the new CLI. However, there is still some JavaScript code being written in the tailwind TS config file. While it may be functional, it is not optimal.

FleetAdmiralJakob avatar Jun 24 '23 12:06 FleetAdmiralJakob

Any updates on this?

FleetAdmiralJakob avatar Jul 16 '23 12:07 FleetAdmiralJakob

I'm running into a similar issue as well

@FleetAdmiralJakob which new CLI are you using to fix this problem?

xih avatar Jul 21 '23 18:07 xih

@xih

Just the new CLI from shadcn/ui.

But for the TS Problem there is no fix, so I'm using the tailwind configuration file from t3-complete

FleetAdmiralJakob avatar Jul 21 '23 18:07 FleetAdmiralJakob

@FleetAdmiralJakob

Ok gotcha. I'm running the create-t3-app CLI and running the CLI through this npx shadcn-ui@latest init and breaking CSS.

image

Your approach seems better - are you manually adding in next-auth and TRPC over?

xih avatar Jul 21 '23 18:07 xih

What do you mean? If I want to use tRPC I use the version from T3. So I'm running the T3 CLI then the shadcn/ui CLI and then replacing the tailwind config with the one from t3-complete (you can leave out the last step)

FleetAdmiralJakob avatar Jul 21 '23 19:07 FleetAdmiralJakob

Here are the steps I'm running to get to that result:

  1. npx create-t3-app@latest
  2. npx shadcn-ui@latest init image
  3. Copy tailwind.config.ts from https://github.com/juliusmarminge/t3-complete/blob/main/tailwind.config.ts and paste that in the new tailwind config file in
  4. change components.json to reflect the typescript config file instead of the javascript one
{
  "$schema": "https://ui.shadcn.com/schema.json",
  "style": "default",
  "rsc": true,
  "tsx": true,
  "tailwind": {
    "config": "tailwind.config.ts",
    "css": "app/globals.css",
    "baseColor": "slate",
    "cssVariables": true
  },
  "aliases": {
    "components": "@/components",
    "utils": "@/lib/utils"
  }
}

Still getting the same styling errors though.

Which one is the last step?

xih avatar Jul 21 '23 22:07 xih

Hi @xih,

I created an example repo for you:

https://github.com/FleetAdmiralJakob/t3-with-app-router-with-shadcn

I created my own tailwind config because I recognized that the one from t3-complete is outdated. My config is type-safe and updated.

You can view the Vercel build with the link on GitHub.

In the README, you can see my CLI steps

FleetAdmiralJakob avatar Jul 22 '23 12:07 FleetAdmiralJakob

Hey @FleetAdmiralJakob !

thank you - I got it working!

can you help me understand what was the problem? I'd love to expand my mental model on what went wrong.

Cheers

xih avatar Jul 22 '23 22:07 xih

Based on what you've shared with me, it seems that the issue was because the configuration of t3-complete was outdated. Alternatively, you could have used the configuration from shadcn/ui, even though it's a Typescript file, as the config is valid JavaScript.

FleetAdmiralJakob avatar Jul 23 '23 08:07 FleetAdmiralJakob

This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.

shadcn avatar Jul 01 '24 23:07 shadcn