๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ’ป DEV/NextJS

[Next.js 13] tailwind css Plugin ์ž‘์„ฑ & ์ ์šฉ

by Rising Oneโ˜… 2023. 9. 27.
728x90
๋ฐ˜์‘ํ˜•
SMALL

NextJS ๋Œ€ํ‘œ๋กœ๊ณ 

 


์ ‘๊ทผ (์š”์•ฝ)

ํ˜„์žฌ ๊ฐœ๋ฐœ์ค‘์ธ ํ”„๋กœ์ ํŠธ์—์„œ Next.js 13๋ฒ„์ „๊ณผ TypeScript ๋ฅผ ๊ธฐ์ˆ ์Šคํƒ์œผ๋กœ ๊ฐ–๊ณ , ์ด์— ๋”๋ถˆ์–ด Tailwind CSS๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ํ•„์š”ํ•œ ์ปดํฌ๋„ŒํŠธ๋ฅผ Tailwind CSS์—์„œ ๊ฐ€์ ธ๋‹ค๊ฐ€ ์‚ฌ์šฉํ•˜๋ ค๋Š” ์ฐฐ๋‚˜, ํ”„๋กœ์ ํŠธ ๋‚ด๋ถ€ tailwind.config.ts ํŒŒ์ผ์— Plugin ๋ถ€๋ถ„์„ ์ถ”๊ฐ€ํ•˜๋ž€ ์•ˆ๋‚ด๋ฅผ ๋”ฐ๋ผ๊ฐ€๋ด…๋‹ˆ๋‹ค.

 

 

  1. (์ƒํ™ฉ) Tailwind css ์ปดํฌ๋„ŒํŠธ ์‚ฌ์šฉ ํ•„์š”

      (1.1) ์ปดํฌ๋„ŒํŠธ ์ฝ”๋“œ ๋‚ด๋ถ€

 

  2. Tailwind CSS Plugin ์ถ”๊ฐ€ & ์„ค์น˜

      (2.1). npm install @ํ”Œ๋Ÿฌ๊ทธ์ธ๋ช…

      (2.2). tailwind.config.ts ํŒŒ์ผ์— ํ”Œ๋Ÿฌ๊ทธ์ธ ์ถ”๊ฐ€


๋ฐฉ๋ฒ•

  1. (์ƒํ™ฉ) Tailwind css ์ปดํฌ๋„ŒํŠธ ์‚ฌ์šฉ ํ•„์š”

      (1.1) ์ปดํฌ๋„ŒํŠธ ์ฝ”๋“œ ๋‚ด๋ถ€

/*
  This example requires some changes to your config:
  
  ```
  // tailwind.config.js
  module.exports = {
    // ...
    plugins: [
      // ...
      require('@tailwindcss/forms'),
    ],
  }
  ```
*/

Plugin ๋ถ€๋ถ„์— ์•„๋ž˜์™€ ๊ฐ™์ด "require('@tailwindcss/forms')" ์ด๋ฅผ ์ถ”๊ฐ€ํ•ด๋‹ฌ๋ž€ ์•ˆ๋‚ด์ด๋‹ค.


  2. Tailwind CSS Plugin ์ถ”๊ฐ€ & ์„ค์น˜

      (2.1). npm install @ํ”Œ๋Ÿฌ๊ทธ์ธ๋ช…

## ์„ค์น˜ํ•˜๊ธฐ

npm i @tailwindcss/forms

 

      (2.2). tailwind.config.ts ํŒŒ์ผ์— ํ”Œ๋Ÿฌ๊ทธ์ธ ์ถ”๊ฐ€

/*
  This example requires some changes to your config:
  
  ```
  // tailwind.config.js
  module.exports = {
    // ...
    plugins: [
      // ...
      require('@tailwindcss/forms'),
    ],
  }
  ```
*/

 


์ด์ƒ์œผ๋กœ, NextJS ๋‚ด TailwindCSS ์‚ฌ์šฉ์‹œ ์ปดํฌ๋„ŒํŠธ์— ๋”ฐ๋ฅธ ํ”Œ๋Ÿฌ๊ทธ์ธ ์ถ”๊ฐ€๋ฅผ ํ•™์Šตํ•ด๋ดค์Šต๋‹ˆ๋‹ค.

์ถ”๊ฐ€ ์งˆ๋ฌธ์„ ๋Œ“๊ธ€์„ ๋‹ฌ์•„์ฃผ์‹œ๋ฉด ๊ฐ์‚ฌํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค^^

์˜ค๋Š˜๋„ ํŒŒ์ดํŒ…์ž…๋‹ˆ๋‹ค! 

728x90
๋ฐ˜์‘ํ˜•
LIST

๋Œ“๊ธ€