[Tailwindcss] ν μΌμλ μ€μΉ λ° μ μ©
μλΉμ€νλλ₯Ό λ§λ€μ΄λ³΄κΈ° μν΄ λΆνΈμ€νΈλ©μ΄ μλ Tailwincss μ¬μ©ν΄ λ§λλ €κ³ νλλ° μ€μΉ λ° μ μ© λ°©λ²μ κΉλ¨Ήμ§ μκΈ° μν΄ μμ±
1. Tailwind μ€μΉ
- Tailwind μ€μΉ ν ν΄λμ 컀맨λ μ°½μ΄λ vscode 컀맨λμ°½μ μλμ½λ μμ±
npm install -D tailwindcss
npx tailwindcss init
2. ν νλ¦Ώ κ²½λ‘ κ΅¬μ±
- tailwind.config.js μ μλ μ½λ μμ±
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./src/**/*.{html,js}"],
theme: {
extend: {},
},
plugins: [],
}
3. tailwind λ μ΄μ΄λ₯Ό μΆκ°νκΈ° μν ν΄λ μμ± λ° css νμΌ μμ±
- λλ src/css/tailwind.css νμΌμ μμ±ν¨
- tailwind.css νμΌμ μλμ κ°μ΄ μμ±
@tailwind base;
@tailwind components;
@tailwind utilities;
4. Tailwind CLI λΉλ
- 3λ²μ μμ±ν νμΌ κ²½λ‘ νμΈνκ³ μμ±
- μλ λͺ λ Ήμ΄ μ€νμ λΉλκ° λκ³ /dist/ouput.css ν΄λμ νμΌμ΄ μμ±
npx tailwindcss -i ./src/css/tailwind.css -o ./dist/output.css --watch
5. HTMLμμ Tailwind μ¬μ©
- src/index.html νμΌ μμ±ν΄μ tailwindλ₯Ό λΉλν /dist/output.css κ²½λ‘ link μ°κ²°
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/dist/output.css" rel="stylesheet">
</head>
<body>
<h1 class="text-3xl font-bold underline">
Hello world!
</h1>
</body>
</html>
κ²°κ³Όλ¬Ό :
μΆμ²
Installation - Tailwind CSS
The simplest and fastest way to get up and running with Tailwind CSS from scratch is with the Tailwind CLI tool.
tailwindcss.com