Skip to main content

Clears the junk out of your CSS.

Project description

Build status

Clears the junk out of your CSS by finding out which selectors are actually not used in your HTML.

This is an unofficial fork (of https://pypi-hypernode.com/pypi/mincss) that runs on both Python 2 and 3.

Example

$ mincss https://github.com

Installation

From pip:

$ pip install --upgrade mincss3k

Why?

With the onslaught of Twitter Bootstrap upon the world it’s very tempting to just download their whole fat 80+Kb CSS and serve it up even though you’re not using half of the HTML that it styles.

There’s also the case of websites that have changed over time but without the CSS getting the same amount of love refactoring. Then it’s very likely that you get CSS selectors that you’re no longer or never using.

This tool can help you get started reducing all those selectors that you’re not using.

Whitespace compression?

No, that’s a separate concern. This tool works independent of whitespace compression/optimization.

For example, if you have a build step or a runtime step that converts all your CSS files into one (concatenation) and trims away all the excess whitespace (compression) then the output CSS can still contain selectors that are never actually used.

What about AJAX?

If you have a script that creates DOM elements in some sort of window.onload event then mincss will not be able to know this because at the moment mincss is entirely static.

So what is a web developer to do? Simple, use /* no mincss */ like this for example:

.logged-in-info {
    /* no mincss */
color: pink;
}

That tells mincss to ignore the whole block and all its selectors.

Project details


Release history Release notifications | RSS feed

This version

0.9

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mincss3k-0.9.tar.gz (11.1 kB view details)

Uploaded Source

File details

Details for the file mincss3k-0.9.tar.gz.

File metadata

  • Download URL: mincss3k-0.9.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mincss3k-0.9.tar.gz
Algorithm Hash digest
SHA256 26d1a9092278a6287b7e1849fe575a3d38421a47736988adf9ba39c8b345cde0
MD5 ac04973c4d8e26c107422541638cde5f
BLAKE2b-256 99ecdb79d48a7253fd7cf4d4eee2f9d641726166976dc49134d88d975f02ce66

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page