๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

study/100 days (100์ผ ์ฑŒ๋ฆฐ์ง€)

[์›น๊ฐœ๋ฐœ 100์ผ] Day 1 - Vite ํ™˜๊ฒฝ์— Tailwindcss ์„ค์น˜ ๋ฐ ์‹คํ–‰ (Tailwind ๋ฒ„์ „ ์˜ค๋ฅ˜ ํ•ด๊ฒฐ)

๋ฐ˜์‘ํ˜•

 
 
 

 
 

๐Ÿš€ ์š”์•ฝ

์ž‘์—… ์‹œ๊ฐ„: 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;


 
 

๋ฐ˜์‘ํ˜•