Skip to content

Commit a3a26c6

Browse files
Added TanStack Start installation guide (#2288)
This PR adds the installation guide of Tailwind CSS version 4 for [TanStack Start](https://tanstack.com/start/latest) Preview URL: https://tailwindcss-com-git-fork-max-programming-ta-2b2c4f-tailwindlabs.vercel.app/docs/installation/framework-guides/tanstack-start Let me know if any changes are required --------- Co-authored-by: Philipp Spiess <[email protected]>
1 parent 6733224 commit a3a26c6

File tree

4 files changed

+150
-0
lines changed

4 files changed

+150
-0
lines changed

src/app/(docs)/docs/installation/framework-guides/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const guides: Guide[] = await create({
1818
angular: () => import("./angular"),
1919
"ruby-on-rails": () => import("./ruby-on-rails"),
2020
"react-router": () => import("./react-router"),
21+
"tanstack-start": () => import("./tanstack-start"),
2122
phoenix: () => import("./phoenix"),
2223
parcel: () => import("./parcel"),
2324
symfony: () => import("./symfony"),
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
import { css, js, Page, shell, Step, Tile } from "./utils";
2+
import Logo from "@/docs/img/guides/tanstack.react.svg";
3+
import LogoDark from "@/docs/img/guides/tanstack-white.react.svg";
4+
5+
export let tile: Tile = {
6+
title: "TanStack Start",
7+
description: "Full-stack Framework powered by TanStack Router for React and Solid.",
8+
Logo,
9+
LogoDark,
10+
};
11+
12+
export let page: Page = {
13+
title: "Install Tailwind CSS with TanStack Start",
14+
description: "Setting up Tailwind CSS in a TanStack Start project.",
15+
};
16+
17+
export let steps: Step[] = [
18+
{
19+
title: "Create project",
20+
body: (
21+
<p>
22+
Start by creating a new TanStack Start project if you don’t have one set up already. The most common approach is
23+
to use <a href="https://tanstack.com/start/latest/docs/framework/react/overview">Create Start App</a>.
24+
</p>
25+
),
26+
code: {
27+
name: "Terminal",
28+
lang: "shell",
29+
code: shell`
30+
npx create-start-app@latest my-project
31+
cd my-project
32+
`,
33+
},
34+
},
35+
{
36+
title: "Install Tailwind CSS",
37+
body: (
38+
<p>
39+
Install <code>@tailwindcss/vite</code> and its peer dependencies via npm.
40+
</p>
41+
),
42+
code: {
43+
name: "Terminal",
44+
lang: "shell",
45+
code: shell`
46+
npm install tailwindcss @tailwindcss/vite
47+
`,
48+
},
49+
},
50+
{
51+
title: "Configure Vite Plugin",
52+
body: (
53+
<p>
54+
Add the <code>@tailwindcss/vite</code> plugin to your Vite configuration.
55+
</p>
56+
),
57+
code: {
58+
name: "vite.config.ts",
59+
lang: "ts",
60+
code: js`
61+
import { tanstackStart } from '@tanstack/react-start/plugin/vite';
62+
import { defineConfig } from 'vite';
63+
import tsConfigPaths from 'vite-tsconfig-paths';
64+
// [!code highlight:2]
65+
import tailwindcss from '@tailwindcss/vite'
66+
67+
export default defineConfig({
68+
plugins: [
69+
// [!code highlight:2]
70+
tailwindcss()
71+
tanstackStart(),
72+
tsConfigPaths(),
73+
]
74+
});
75+
`,
76+
},
77+
},
78+
{
79+
title: "Import Tailwind CSS",
80+
body: (
81+
<p>
82+
Add an <code>@import</code> to <code>./src/styles.css</code> that imports Tailwind CSS.
83+
</p>
84+
),
85+
code: {
86+
name: "src/styles.css",
87+
lang: "css",
88+
code: css`
89+
@import "tailwindcss";
90+
`,
91+
},
92+
},
93+
{
94+
title: "Import the CSS file in your root route",
95+
body: (
96+
<p>
97+
Import the CSS file in your <code>__root.tsx</code> file with the <code>?url</code> query.
98+
</p>
99+
),
100+
code: {
101+
name: "src/routes/__root.tsx",
102+
lang: "tsx",
103+
code: js`
104+
// other imports...
105+
106+
// [!code highlight:2]
107+
import appCss from '../styles.css?url'
108+
109+
export const Route = createRootRoute({
110+
head: () => ({
111+
meta: [
112+
// your meta tags and site config
113+
],
114+
// [!code highlight:2]
115+
links: [{ rel: 'stylesheet', href: appCss }],
116+
// other head config
117+
}),
118+
component: RootComponent,
119+
})
120+
`,
121+
},
122+
},
123+
{
124+
title: "Start using Tailwind in your project",
125+
body: <p>Start using Tailwind’s utility classes to style your content.</p>,
126+
code: {
127+
name: "src/routes/index.tsx",
128+
lang: "tsx",
129+
code: js`
130+
import { createFileRoute } from '@tanstack/react-router'
131+
132+
export const Route = createFileRoute('/')({
133+
component: App,
134+
})
135+
136+
function App() {
137+
return (
138+
// [!code highlight:4]
139+
<h1 class="text-3xl font-bold underline">
140+
Hello World!
141+
</h1>
142+
)
143+
}
144+
`,
145+
},
146+
},
147+
];
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)