Ensuring your CSS is well written and formatted correctly is essential to good website design. As more and more CSS is being used to style websites it’s important to optimise your CSS files.
Once I have finished a project and have made sure all the formatting is correct, I place a copy of this file (with comments) into a ‘source’ folder (example). I then run my CSS through the cleancss.com utility using the ‘High (moderate readability, smaller size)’ compression. I also strip out all the comments at this stage and then upload this file for use with the website (example).
You now have the source file with comments and good readability in case you need to go back to alter or add something at a later date. You can then run the CSS through the utility again and replace the master.css file. You end up with all your selectors and their properties in the correct order and a CSS file which is smaller in file size which will enable you to maximise your server’s resources.