Course contentsShow
← Web Development
Lesson 616 of 2,98211. Utility-First CSS with TailwindFree lesson

Development vs Production Builds

Understand build optimization, file size differences, and purging strategies for production.

Development vs Production Builds

You'll learn how Tailwind CSS creates different builds for development and production to optimize performance.

The Core Concept

When you're building a website with Tailwind CSS, you work in two distinct modes: development and production. During development, Tailwind includes every possible utility class in your CSS file so you can freely experiment and build. This file is huge — often several megabytes!

For production (your live website), Tailwind uses a process called purging or tree-shaking to scan your HTML, JavaScript, and template files, keeping only the utility classes you actually use. The result? A tiny CSS file, often under 10KB.

Think of it like packing for a trip: during development, you keep your entire wardrobe available (just in case). For production, you pack only the clothes you'll actually wear.

How It Works

In your tailwind.config.js, the content array (which you configured earlier) tells Tailwind where to look for class names:

content: ['./src/**/*.html', './src/**/*.js']

When building for production, Tailwind scans these files and removes any unused utilities. A development build might be 3MB, while the production build drops to 8KB — that's a 99.7% reduction!

Why This Matters

  • Development: Fast rebuilds, all utilities available, easier debugging
  • Production: Minimal file size, faster page loads, better user experience

Your build tool (like Vite or webpack) typically handles this automatically based on NODE_ENV.

Key Takeaway: Tailwind's development builds prioritize developer experience with complete utility availability, while production builds purge unused classes to deliver minimal, optimized CSS files to end users.