์๋น์คํ๋๋ฅผ ๋ง๋ค์ด๋ณด๊ธฐ ์ํด ๋ถํธ์คํธ๋ฉ์ด ์๋ 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
'๊ฐ๋ฐ ยท๊ณต๋ถ > WEB' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[CSS] ๋ง์ง(margin), ํจ๋ฉ(padding) (0) | 2023.01.15 |
---|---|
[Thymeleaf] if ~ else ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ (if, unless) (0) | 2022.08.10 |
[Thymeleaf] fragment, replace ๋ฅผ ํ์ฉํ html include ๋ฐฉ๋ฒ (0) | 2022.08.09 |
[Mybatis] ๋์ฉ๋ ๋ฐ์ดํฐ ์กฐํ ์ ์ฑ๋ฅ ํฅ์ ๋ฐฉ๋ฒ "fetchSize" (0) | 2022.07.04 |