@@ -235,157 +235,6 @@ let tabs = [
235
235
return (
236
236
> <h1 className="text-3xl font-bold underline">
237
237
> Hello world!
238
- > </h1>
239
- )
240
- }` ,
241
- } ,
242
- } ,
243
- ] ,
244
- } ,
245
- {
246
- name : 'Using Turbopack' ,
247
- key : 'using-turbopack' ,
248
- href : '#turbopack' ,
249
- intro : ( ) => (
250
- < p >
251
- < a href = "https://turbo.build/pack" > Turbopack</ a > is currently in alpha and doesn’t yet
252
- expose any public plugin APIs, so the best way to integrate Tailwind CSS is using Tailwind
253
- CLI to compile your CSS alongside your development server.
254
- </ p >
255
- ) ,
256
- steps : [
257
- {
258
- title : 'Create your project' ,
259
- body : ( ) => (
260
- < p >
261
- Start by creating a new Next.js project if you don’t have one set up already. The most
262
- common approach is to use{ ' ' }
263
- < a href = "https://nextjs.org/docs/api-reference/create-next-app" > Create Next App</ a > .
264
- </ p >
265
- ) ,
266
- code : {
267
- name : 'Terminal' ,
268
- lang : 'terminal' ,
269
- code : 'npx create-next-app@latest my-project --typescript --eslint\ncd my-project' ,
270
- } ,
271
- } ,
272
- {
273
- title : 'Install Tailwind CSS' ,
274
- body : ( ) => (
275
- < p >
276
- Install < code > tailwindcss</ code > , its peer dependencies, and < code > concurrently</ code > { ' ' }
277
- via npm, and then run the init command to generate a < code > tailwind.config.js</ code > { ' ' }
278
- file.
279
- </ p >
280
- ) ,
281
- code : {
282
- name : 'Terminal' ,
283
- lang : 'terminal' ,
284
- code : 'npm install -D tailwindcss autoprefixer concurrently\nnpx tailwindcss init' ,
285
- } ,
286
- } ,
287
- {
288
- title : 'Configure your template paths' ,
289
- body : ( ) => (
290
- < p >
291
- Add the paths to all of your template files in your < code > tailwind.config.js</ code > { ' ' }
292
- file.
293
- </ p >
294
- ) ,
295
- code : {
296
- name : 'tailwind.config.js' ,
297
- lang : 'js' ,
298
- code : ` /** @type {import('tailwindcss').Config} */
299
- module.exports = {
300
- > content: [
301
- > "./pages/**/*.{js,ts,jsx,tsx}",
302
- > "./components/**/*.{js,ts,jsx,tsx}",
303
- > ],
304
- theme: {
305
- extend: {},
306
- },
307
- plugins: [],
308
- }` ,
309
- } ,
310
- } ,
311
- {
312
- title : 'Update your package.json scripts' ,
313
- body : ( ) => (
314
- < p >
315
- Update the scripts in your < code > package.json</ code > file to build both your development
316
- and production CSS.
317
- </ p >
318
- ) ,
319
- code : {
320
- name : 'package.json' ,
321
- lang : 'diff-json5' ,
322
- code : `"scripts": {
323
- - "dev": "next dev",
324
- - "build": "next build",
325
- + "dev": "concurrently \\\"next dev --turbo\\\" \\\"tailwindcss -i styles/globals.css -o styles/dist.css -w\\\"",
326
- + "build": "tailwindcss -m -i styles/globals.css -o styles/dist.css && next build",
327
- "start": "next start",
328
- "lint": "next lint"
329
- }` ,
330
- } ,
331
- } ,
332
- {
333
- title : 'Add the Tailwind directives to your CSS' ,
334
- body : ( ) => (
335
- < p >
336
- Add the < code > @tailwind</ code > directives for each of Tailwind’s layers to your{ ' ' }
337
- < code > ./styles/globals.css</ code > file.
338
- </ p >
339
- ) ,
340
- code : {
341
- name : 'globals.css' ,
342
- lang : 'css' ,
343
- code : '@tailwind base;\n@tailwind components;\n@tailwind utilities;' ,
344
- } ,
345
- } ,
346
- {
347
- title : 'Import the compiled CSS file' ,
348
- body : ( ) => (
349
- < p >
350
- Update your < code > ./pages/_app.tsx</ code > file to import the compiled CSS file.
351
- </ p >
352
- ) ,
353
- code : {
354
- name : '_app.tsx' ,
355
- lang : 'diff-js' ,
356
- code : `- import '../styles/globals.css'
357
- + import '../styles/dist.css'
358
-
359
- function MyApp({ Component, pageProps }) {
360
- return <Component {...pageProps} />
361
- }
362
-
363
- export default MyApp` ,
364
- } ,
365
- } ,
366
- {
367
- title : 'Start your build process' ,
368
- body : ( ) => (
369
- < p >
370
- Run your build process with < code > npm run dev</ code > .
371
- </ p >
372
- ) ,
373
- code : {
374
- name : 'Terminal' ,
375
- lang : 'terminal' ,
376
- code : 'npm run dev' ,
377
- } ,
378
- } ,
379
- {
380
- title : 'Start using Tailwind in your project' ,
381
- body : ( ) => < p > Start using Tailwind’s utility classes to style your content.</ p > ,
382
- code : {
383
- name : 'index.tsx' ,
384
- lang : 'jsx' ,
385
- code : ` export default function Home() {
386
- return (
387
- > <h1 className="text-3xl font-bold underline">
388
- > Hello world!
389
238
> </h1>
390
239
)
391
240
}` ,
0 commit comments