๐ ์์ฝ
์์
์๊ฐ: 2์๊ฐ๋ฐ
โ
Vite + React + TypeScript ํ๋ก์ ํธ ์ค์
โ
ESLint & Prettier, Tailwind ์ค์น ๋ฐ ์ค์
๐ React + Vite ํ๊ฒฝ์ Tailwind ์ค์นํ๊ธฐ
์ ์ฒซ๋ ๋ถํฐ ์ง์ด ๋ค ๋น ์ง๋ค.
๋จธ๋ฆฌ์์ ์คํ ๋์ค๊ณ ์์ง๋ง ์๊ฐ๋ง 1๋
๋๊ฒ ํ๋ ๊ฐ์ธ ํ๋ก์ ํธ์ ์ฒซ ๋ฐ์ ๋๋ ๊ฑฐ ๊ฐ์์ ์๋ฏธ ์๋ ์๊ฐ์ด์๋ค ๐
๋ค ์๋ก ์จ๋ณด๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ค์ด๋ผ ์ผ๋จ ์ฑ์งํผํฐ๊ฐ ์ํค๋ ์์๋๋ก ํ๊ฒฝ๊ตฌ์ถํ๊ณ ์๋๋ฐ Tailwind ์ค์น ๋ฐ ์คํ์๋ง 2์๊ฐ์ด ๊ฑธ๋ ธ๋ค;
์งํผํฐ๊ฐ ๊ณ์ ํฐ๋ฏธ๋์์ tailwindcss๋ฅผ ์คํํ๊ฒ ํ์ง๋ง, ๋ฌด์จ ๋ฐฉ๋ฒ์ ์จ๋ ์ ๋๋ก ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ค์น๋ ์ ๋๋ ๊ฒ ๊ฐ๊ณ ๋น์ฐํ ์คํ๋ ๋์ง ์์๋ค ๐ซ
๋ฌธ์ ์ ๋ผ์ธ ๐๐๐ฅ
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
์๋ฌ ๋ฉ์ธ์ง
npm error could not determine executable to run npm error A complete log of this run can be found in: (๋ก๊ทธ ํ์ผ ์ฃผ์)
์คํ ์ค๋ฒํ๋ก์ฐ์์ ์ฐพ์ ๋ต๋ณ์ผ๋ก๋ ๋ด๊ฐ ์ค์นํ tailwind๊ฐ 4๋ฒ์ ์ด์ด์ ์๊ธด ๋ฌธ์ ์ธ ๋ฏํ๋ค.
3์ผ๋ก ๋ฎ์ถฐ์ฃผ๋ฉด ์ ์์ ์ผ๋ก ์คํ๋๋ค.
npm install tailwindcss@3
Error: 'could not determine executable to run' when initializing Tailwind CSS with shadcn/ui
I'm working on a React project and using shadcn/ui. I tried to install and set up Tailwind CSS using the following commands: Installed Tailwind CSS, PostCSS, and Autoprefixer: npm install -D
stackoverflow.com
๊ทธ๋๋ก 4๋ฒ์ ์ ์ฌ์ฉํ๊ณ ์ถ์ ๊ฒฝ์ฐ Using Vite ์น์ ์ ๋ด์ฉ๋๋ก ๋ฐ๋ผํ๋ฉด ๋๋ค.
๋ค๋ง init ๋ช ๋ น์ ์คํํ์ง ์๊ธฐ ๋๋ฌธ์ tailwind.config.js ๋ฑ ๊ฐ์ข ์ค์ ํ์ผ์ด ์๋์ผ๋ก ์๊ธฐ์ง ์์.
Installing with Vite - Installation
Integrate Tailwind CSS with frameworks like Laravel, SvelteKit, React Router, and SolidJS.
tailwindcss.com
postcss.config.js์ ๋ค์ ์ฝ๋ ์ถ๊ฐ
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
tailwind.config.js์ content์ ํญ๋ชฉ ์ถ๊ฐ
export default {
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {},
},
plugins: [],
};
App.tsx๋ก ํ
์คํธ
import "./App.css";
function App() {
return (
<>
<div className="flex items-center justify-center h-[100px] bg-gray-100">
<h1 className="text-3xl font-bold text-blue-500">Hello, world!</h1>
</div>
</>
);
}
export default App;
์ ์ ์ฉ๋๋ค ๐ฅน
+
์ ๋๋ก ์๋ํ์ง ์์ ๊ฒฝ์ฐ tailwindcss import ํด๋์ index.css์ ์๋ ์ฝ๋๋ ์ถ๊ฐ
@tailwind base;
@tailwind components;
@tailwind utilities;