TailwindCSS & Emotion setting with nextJs

김재훈·2023년 1월 7일
0

TailwindCss & Emotion 설정때문에 공식문서 들락날락하다가 한 곳에 정리합니다.

TailwndCSS setting

  • yarr add -D tailwindcss postcss autoprefixer

  • yarn tailwindcss init -p

  • tailwind.config.js > content에 아래 코드 추가

    './src/components/**/*.{js,ts,jsx,tsx}',
     './src/pages/**/*.{js,ts,jsx,tsx}',
  • globals.css에 아래코드 추가

     @tailwind base
     @tailwind components
     @tailwind utilities

    Emotion setting

  • yarn add @emotion/styled @emotion/react

  • next.config.js > compiler에 emotion: true 추가

  • tsconfig.json에 "types": ["@emotion/react/types/css-prop"] 추가
    -> 없어도 사용가능하지만 타스에러 해결을 위해 사용

profile
문제 해결에 도움되는 기술들을 좋아합니다.

0개의 댓글