This is an official starter Turborepo.
Run the following command to start a default turborepo:
npx create-turbo@latest
-
Go to packages/ui and install tailwindcss.
npm install -D tailwindcss postcss autoprefixer
create tailwind.config.ts file and postcss.config.js files
add the below to postcss.config.js ```javascript // eslint-disable-next-line no-undef module.exports = { plugins: { tailwindcss: {}, autoprefixer: {}, }, }; ```
-
Now install schadcnui cli
npx shadcn-ui@latest init
-> choose the default options (will change later)
-> copy the components folder and lib folder (auto created while installing shadcn ui.) inside the src. -> create a styles folder inside src. -> copy the globals.css file inside the styles folder.
-
Inside packages/tsconfig.json add the follwing:
"baseUrl": ".", "paths": { "@ui/*": ["./src/*"], "@ui/components/ui*": ["./src/components/ui*"] }
mine looks like this
{ "extends": "@repo/typescript-config/react-library.json", "compilerOptions": { "outDir": "dist", "baseUrl": ".", "paths": { "@ui/_": ["./src/_"], "@ui/components/ui*": ["./src/components/ui*"] } }, "include": ["src"], "exclude": ["node_modules", "dist"] }
-
Change the path for css and aliases inside packages/components.json
{ "$schema": "https://ui.shadcn.com/schema.json", "style": "default", "rsc": true, "tsx": true, "tailwind": { "config": "tailwind.config.ts", "css": "src/styles/globals.css", "baseColor": "slate", "cssVariables": true, "prefix": "" }, "aliases": { "components": "@ui/components", "utils": "@ui/lib/utils" } }
-
inside packages/typescript-config/nextjs.json change the paths add the follwing path
"paths": { "@ui/*": ["../../packages/ui/src/*"] }
-
inside your next.js app apps/appname
-> install tailwindcss
npm install -D tailwindcss postcss autoprefixer
-> inside tailwind.config.ts export * from "@repo/ui/tailwind.config";
-> inside postcss.config.js module.exports = require("@repo/ui/postcss.config");
-> in app/layout.tsx change the globals.css import
import "@repo/ui/globals.css";
Do a npm install in the root folder just for good Measures.
### run the install command from the shadcn document inside packages/ui.