Your project now has Tailwind CSS v3 fully configured and production-ready!
tailwind.config.js- Tailwind configuration with custom theme extensionspostcss.config.js- PostCSS configuration for Tailwind processingsrc/index.css- Updated with Tailwind directives and utility classesvite.config.js- Enhanced with production optimizationspackage.json- Addedbuild:prodscript.env.example- Environment variables templatePRODUCTION.md- Complete production deployment guide
npm install
npm run preparenpm run devnpm run buildor
npm run build:prodnpm run preview- ✅ Configured with custom theme (colors, animations, fonts)
- ✅ PurgeCSS enabled (removes unused styles in production)
- ✅ Custom
@layerorganization for better specificity control - ✅ Full
@applydirective support (v3 has better support than v4) - ✅ Responsive design built-in
- ✅ Dark mode ready (can be enabled if needed)
- ✅ Production-stable and battle-tested
- ✅ Minification: Terser for JS compression
- ✅ Console Removal: Auto-removes console.logs in production
- ✅ Code Splitting: Separate chunks for React and Google AI SDK
- ✅ CSS Optimization: Unused Tailwind classes removed automatically
- ✅ Source Maps: Disabled for smaller bundle size
- ✅ Chunk Size Optimization: Configured for optimal loading
// Available in your Tailwind config
colors: {
gradient: {
purple: '#667eea',
'purple-dark': '#764ba2',
pink: '#f093fb',
red: '#f5576c',
blue: '#4facfe',
},
}
animations: {
float: 'float 6s ease-in-out infinite',
slideInUp: 'slideInUp 0.5s ease-out',
}<div className="flex items-center justify-center p-4 bg-white rounded-lg">
<h1 className="text-2xl font-bold text-gray-800">Hello World</h1>
</div>.my-custom-button {
@apply px-4 py-2 bg-blue-500 text-white rounded-lg;
@apply hover:bg-blue-600 transition-colors duration-300;
}Your existing custom classes (like .glass-card, .welcome-section, etc.) are preserved and work alongside Tailwind!
m-{size}- marginp-{size}- paddinggap-{size}- gap in flex/grid
flex,grid,block,inline-blockitems-center,justify-betweenw-full,h-screen,max-w-lg
text-{size}- font sizefont-{weight}- font weighttext-{color}- text colorleading-{height}- line height
bg-{color}- backgroundtext-{color}- textborder-{color}- border
shadow-{size}- box shadowrounded-{size}- border radiusopacity-{amount}- opacityblur-{amount}- backdrop blur
<div className="w-full md:w-1/2 lg:w-1/3">
{/* Full width on mobile, half on tablet, third on desktop */}
</div>Breakpoints:
sm:- 640pxmd:- 768pxlg:- 1024pxxl:- 1280px2xl:- 1536px
Edit tailwind.config.js:
theme: {
extend: {
colors: {
'my-color': '#123456',
}
}
}In src/index.css:
@layer utilities {
.my-custom-utility {
/* your styles */
}
}In src/index.css:
@layer components {
.my-component {
@apply flex items-center gap-4 p-4;
/* additional custom styles */
}
}After running npm run build, you'll get:
dist/
├── index.html
├── assets/
│ ├── index-{hash}.js # Main bundle (optimized)
│ ├── react-vendor-{hash}.js # React bundle (cached separately)
│ ├── google-ai-{hash}.js # Google AI bundle
│ └── index-{hash}.css # Optimized CSS (purged)
These are expected and can be safely ignored. They're just warnings about Tailwind-specific directives that standard CSS linters don't recognize.
- Make sure classes are in the
contentarray intailwind.config.js - Check if you need to restart the dev server
- Ensure
index.cssis imported in your entry file
- Run
npm installfirst - Clear cache:
rm -rf node_modules/.vite - Try
npm run buildagain
Your project is now production-ready with Tailwind CSS!
To get started:
npm install # Install dependencies
npm run dev # Start developmentHappy coding! 🚀