UNPKG

vt-tw

Version:

A fully initialized React Vite + Tailwind CSS starter template to kickstart modern front-end projects. This package provides an optimized and minimal boilerplate with fast development, zero-config setup, and best practices.

111 lines (94 loc) • 2.32 kB
# React Vite + Tailwind CSS This is a simple React project using Vite and Tailwind CSS for fast development and styling. ## šŸš€ Getting Started ### 1ļøāƒ£ Prerequisites Make sure you have the following installed: - [Node.js](https://nodejs.org/) (LTS recommended) - npm (comes with Node.js) or yarn ### 2ļøāƒ£ Create a New Vite Project Run the following command to create a new Vite project: ```sh npm create vite@latest my-app --template react ``` OR (if using yarn) ```sh yarn create vite@latest my-app --template react ``` ### 3ļøāƒ£ Navigate to Project Folder ```sh cd my-app ``` ### 4ļøāƒ£ Install Dependencies ```sh npm install ``` OR ```sh yarn install ``` ### 5ļøāƒ£ Install Tailwind CSS Run the following command: ```sh npm install -D tailwindcss postcss autoprefixer ``` ### 6ļøāƒ£ Initialize Tailwind CSS ```sh npx tailwindcss init -p ``` This creates `tailwind.config.js` and `postcss.config.js`. ### 7ļøāƒ£ Configure Tailwind Edit `tailwind.config.js` to enable Tailwind in all files: ```js /** @type {import('tailwindcss').Config} */ export default { content: [ "./index.html", "./src/**/*.{js,ts,jsx,tsx}" ], theme: { extend: {}, }, plugins: [], } ``` ### 8ļøāƒ£ Add Tailwind to CSS Replace the content of `src/index.css` with: ```css @tailwind base; @tailwind components; @tailwind utilities; ``` ### 9ļøāƒ£ Start the Development Server ```sh npm run dev ``` OR ```sh yarn dev ``` ## šŸ“ Project Structure ``` my-app/ │-- src/ │ ā”œā”€ā”€ components/ # Reusable components │ ā”œā”€ā”€ pages/ # Page components │ ā”œā”€ā”€ App.jsx # Main App component │ ā”œā”€ā”€ main.jsx # Entry file │-- public/ # Static files │-- index.html # Root HTML file │-- package.json # Project dependencies │-- tailwind.config.js # Tailwind configuration │-- vite.config.js # Vite configuration ``` ## āœ… Deployment To build your project for production, run: ```sh npm run build ``` Then, you can deploy the `dist` folder to any static hosting service like **Vercel**, **Netlify**, or **GitHub Pages**. ## šŸŽÆ Additional Resources - [Vite Documentation](https://vitejs.dev/) - [React Documentation](https://react.dev/) - [Tailwind CSS Documentation](https://tailwindcss.com/) --- Happy Coding! šŸš€