🌐Minification
Also known as Minify, Minifier, Code Minification
Making code smaller. It cuts spaces, notes and long names, and the code still works.
Think of it like
Think of it like squeezing the air out of a bag of clothes. Same clothes, much smaller bag.
Example
Jack's 180 KB script shrinks to 60 KB once it is minified. The page loads much faster on a phone.
Why it matters
Each byte has to travel to each visitor. Making files smaller is free speed.
Definition
Example code
javascript
// before
function addNumbers(first, second) {
return first + second;
}
// after
function a(n,r){return n+r}Common mistake
Key takeaways
- 1Strip the extras. Spaces, comments, long names.
- 2Same behaviour. It runs exactly the same.
- 3Smaller downloads. Faster pages, mostly on phones.