What is minification?
Many times the team or individual that created a stylesheet will include comments, spacing between items, extra whitespace, and various other things that make the file easier to read for a human. But a browser does not need any of that to work properly and is why minification is a great way to easily save on file space.
How do I minify something?
- http://code.jquery.com/jquery-1.7.1.min.js (minified)
- http://code.jquery.com/jquery-1.7.1.js (NOT minified)
You can also click each of these to see what minification visually does to a file.
What will I gain?
While you most likely will not see any significant decrease in your bandwidth bill, the point of minification isn’t for the website owner, it is for the website visitor.
It has been proven in multiple studies that the faster your page is, the more time a user spends on your site which in many cases leads to more page views.
Some website owners see a reduction in size of up to 40%, and the average reduction is between 10-20% per minified file.
Are there any risks involved?
The risks are small, but when you minify something, an algorithm is ran against the file and things are removed from the file. Anytime something is removed from a file, you run the risk of something critical being removed from the file.
Personally, I have never experienced any of these problems, but as a programmer, I know how minification is performed and I would advise anyone only to use minification tools that are endorsed by authoritative figures.
All the tools linked in this blog post have been used personally by myself on most of the websites I develop and own.