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
Markdown
# 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! š