Source
Readable files developers edit.
Minification reduces CSS file size for production delivery while keeping the source files readable for development.
/* source */
.button { min-height: 44px; }
/* output */
.button{min-height:44px}
Production mental model
CSS written for humans should be readable, organized and commented where needed. CSS delivered to browsers can be smaller.
Minification removes whitespace, comments and optional characters so production files transfer faster.
The important distinction is source versus build output. Developers maintain clean source CSS; deployment serves optimized CSS.
Readable files developers edit.
Tooling combines, processes or minifies.
Small CSS file served to users.
Versioned filenames prevent stale assets.
Visual model
Readable project files stay maintainable.
Whitespace and comments are removed.
Production receives the smaller file.
Browsers know when CSS changed.
Good CSS versus fragile CSS
/* source */
.button {
min-height: 44px;
border-radius: 999px;
}
/* output */
.button{min-height:44px;border-radius:999px}
.button{min-height:44px;border-radius:999px}.card{padding:24px}.nav{display:flex}
/* Where does the bug live now? */
Rules of thumb
Do not sacrifice maintainability inside the files developers edit.
Optimization should be repeatable, not manual.
Gzip or Brotli usually matters more than minification alone.
Cache busting prevents old CSS from staying in the browser after deploy.
Source maps help debug production CSS without editing output files.
Comments can disappear from output, but architecture should remain clear in source.
Production thinking
Minification is a delivery detail. It makes the site lighter without making the codebase worse.
Minification should never change behavior. If focus or reduced-motion CSS disappears, the build process is broken.
Treat minification as part of a repeatable release pipeline with testing before deploy.
Smaller CSS can improve loading speed, especially when paired with compression and caching.
Live code lab
The preview runs in an isolated iframe. Links and forms stay inside the practice area, so you can experiment without leaving the lesson.
Mini assignment
Practice assignment
Try it yourself
Self-check
Answer these questions before moving on. Production CSS is not about writing more rules; it is about proving the rules survive real use.
Senior audit upgrade
Minification removes unnecessary characters from source. gzip or Brotli compresses bytes in transfer. Cache busting controls when browsers fetch a new file.
Remove whitespace and comments from production CSS output.
Serve CSS with gzip or Brotli where possible.
Use app.a1b2c3.css style filenames so long caching stays safe.