Notice
Recent Posts
Recent Comments
Link
보조기억장치
Install tailwindcss with Next.js 본문
프로젝트 생성
npx create-next-app@latest my-app
Tailwind CSS 설치
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
postcss.config.js 파일 생성
환경설정
파일명 : tailwind.config.js
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {},
},
plugins: [],
};
파일명 : styles/globals.css
@tailwind base;
@tailwind components;
@tailwind utilities;
적용테스트
파일명 : pages/index.js
export default function Home() {
return <div className="bg-red-500">test</div>;
}
vscode 에서 자동완성기능 사용을 위한 Tailwind CSS IntelliSense 플러그인 설치
https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss
'React' 카테고리의 다른 글
Next.js 13.4 (0) | 2023.05.06 |
---|---|
Next.js Error [TypeError]: Cannot read properties of undefined (reading 'map') (0) | 2023.05.04 |
Material UI(MUI) DataGrid 적용하 (0) | 2023.04.28 |
Test Suites Group (0) | 2023.04.08 |
Matched leaf route at location "/" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page. (0) | 2023.04.07 |