This article was published on January 27, 2013

Mincss clears the junk out of your CSS, finds and removes selectors you’re not using


Mincss clears the junk out of your CSS, finds and removes selectors you’re not using

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 CompressorCode 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.

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.

Bengtsson notes that mincss is also particularly handy when using a heavy, uncustomized framework like Bootstrap. This tool, however, doesn’t play friendly with elements created by JavaScript.

The 💜 of EU tech

The latest rumblings from the EU tech scene, a story from our wise ol' founder Boris, and some questionable AI art. It's free, every week, in your inbox. Sign up now!

See how to use mincss here (it’s not exactly beginner-friendly) and learn more about the project via the link below.

➤ mincss

Get the TNW newsletter

Get the most important tech news in your inbox each week.