1. yarn add -D tailwindcss@latest postcss@latest autoprefixer@latest
2. yarn tailwindcss init -p
tailwind.config.js 파일이 생김.
3. 아래 붙여넣음.
/** @type {import('tailwindcss').Config} */
module.exports = {
purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
content: [],
theme: {
extend: {},
},
plugins: [],
};
이렇게 하면 최종 프로덕션 빌드에서 모든 사용하지 않는 스타일을 효과적으로 제거하여 파일 크기를 크게 줄일 수 있다고함.
4. global.css에 아래 코드 첫번째 줄에 넣음.
@tailwind base;
@tailwind components;
@tailwind utilities;
5. 완료!
'Next' 카테고리의 다른 글
next14) use server에서 use client 컴포넌트를 import해서 사용하는 방법 (0) | 2024.08.18 |
---|---|
저장 시 prettier 작동하도록 설정하는 법 (format on save) (0) | 2023.10.18 |
useCallback과 useMemo에 대해 완벽하게 이해해보기. (0) | 2023.08.17 |
javascript 요일 알아내기 .getDay() (0) | 2023.08.15 |