Minification and Merging
When deploying your website to a production environment, i.e. running it live for people to use, you should optimise your frontend scripts so that they load as fast as possible and use as little bandwidth as is necessary. This has two benefits:
- It cuts down on your bandwidth use, and thus your CDN costs (though generally, this will be a negligible financial saving)
- It reduces load times for users visiting your website, as they have to load fewer files and the files are smaller overall.
Minification
Minification means stripping out all whitespace, and other characters that are only there for presentation, from scripts. Minifying your JavaScript and CSS files reduces their size; you don't need to be able to read the files when they're in production, only in development.
Merging
If you have lots and lots of separate JS or CSS files that are all required to load before your website loads, the size of the files isn't the only performance bottleneck. Each file requires a separate HTTP request, and so having a large number of scripts loading slows down the load time of your website.