In the past we’ve covered ways Web designers can keep their CSS clean, highlighting ProCSSor, a desktop app for the Mac which cleans up and compresses your code; as well as CSS Compressor; Code Beautifier; and CSS Beautify.
None of these options, however, remove unused CSS to help keep your site extra lean. That’s where mincss comes in.
F**k it, we'll do it live!
Our biggest ever edition of TNW Conference is fast approaching! Join 10,000 tech leaders this May in Amsterdam.
As its creator Peter Bengtsson explains, mincss is a tool that when given a URL (or multiple URLs) downloads that page and all its CSS and compares each and every selector in the CSS” to find out what isn’t used. The result is your original CSS file with those unused selectors (not found in your HTML) removed.
Put more simply, if I style a paragraph of text, and then end up replacing that paragraph with a video, I would be left with unused paragraph styles in my CSS. Mincss makes sure you’ve removed these unused styles to keep your CSS light and clean.
See how to use mincss here (it’s not exactly beginner-friendly) and learn more about the project via the link below.