Performance
Minification
Minification is rewriting source code into a smaller, equivalent file by stripping whitespace, comments, and long local names. The browser runs the same program and downloads fewer bytes.
How it is measured
Compare the file before and after the build step. A 412 KB `app.js` that becomes 168 KB is the number to record. Then check the compressed size too, because gzip or Brotli shrinks readable source far more than it shrinks code that is already mangled. Lighthouse flags leftovers under 'Minify JavaScript' and 'Minify CSS'.
Confirm it in production, not in the repo. Open the live asset in DevTools and read the first few lines. If you can see indentation and full function names, the minifier never ran or a plugin served the dev build. Check inline `<script>` and `<style>` blocks in the HTML too, since most build tools skip them.
Worked example
A WordPress theme ships `style.css` at 96 KB, with comments left by three developers. Running it through cssnano produces 71 KB, and Brotli at the CDN takes that to 13 KB on the wire. The theme's `main.js` goes from 240 KB to 98 KB.
The gain shows on a throttled phone, where parsing 240 KB of script costs more than downloading it. Lab LCP moves from 3.4 s to 3.0 s and nothing else on the page changed.
How it differs
Minification shrinks the code you wrote, character by character. Tree shaking removes whole exports that nothing imports. A bundle can be perfectly minified and still carry a 300 KB charting library of which the page calls one function. Gzip is a third thing: transport compression applied to whatever file you send, minified or not.
Common errors
Minifying only in development and then debugging the output. Running a second minifier over a `.min.js` file and breaking it. Judging savings on raw size and ignoring compressed size. Leaving inline scripts and styles in the template untouched. Publishing source maps on a public path without meaning to.
In practice
Check that your build runs in production mode, then spot-check three live asset URLs for readable code. Add a CSS minifier if you only have a JS one. Send source maps to your error tracker instead of your public folder. After that, stop: bigger savings come from shipping less code, not from squeezing characters.