Deployment#
This guide will walk you through deploying your HTML, Tailwind CSS, and Vite project to Vercel. Vercel provides excellent support for static sites and offers seamless deployment with automatic builds and deployments.
Prerequisites#
Before deploying, ensure you have:
- A Vercel account (sign up here)
- Your project code pushed to a Git repository (GitHub, GitLab, or Bitbucket)
- Node.js installed locally for building
Project Setup#
1. Build Configuration
Make sure your vite.config.js
is properly configured for production builds:
import { defineConfig } from 'vite'
export default defineConfig({
build: {
outDir: 'dist',
assetsDir: 'assets',
rollupOptions: {},
},
})
2. Build Scripts
Ensure your package.json
has the correct build scripts:
{
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
}
}
Deployment Methods#
Method 1: Vercel Dashboard (Recommended)
-
Connect Repository
- Go to vercel.com and sign in
- Click "New Project"
- Import your Git repository
- Select the repository containing your project
-
Configure Project Settings
- Framework Preset: Select "Vite"
- Root Directory: Leave as
./
- Build Command:
yarn build
ornpm run build
- Output Directory:
dist
- Install Command:
yarn install
ornpm install
-
Deploy
- Click "Deploy"
- Vercel will automatically build and deploy your project
Method 2: Vercel CLI
-
Install Vercel CLI
npm i -g vercel
-
Login to Vercel
vercel login
-
Deploy from Project Directory
cd your-project-directory vercel
-
Follow the CLI Prompts
- Link to existing project or create new
- Confirm build settings
- Deploy
Support Resources#
Your HTML, Tailwind CSS, and Vite project is now successfully deployed on Vercel! 🚀