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.

By Peter Bengtsson, 2012-2015

Tested in Python 2.7, 3.3 and 3.4

Example

$ mincss https://github.com

Installation

From pip:

$ pip install mincss

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


Download files

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

Source Distribution

mincss-0.8.3.tar.gz (11.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mincss-0.8.3-py27-none-any.whl (12.7 kB view details)

Uploaded Python 2.7

mincss-0.8.3-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file mincss-0.8.3.tar.gz.

File metadata

  • Download URL: mincss-0.8.3.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mincss-0.8.3.tar.gz
Algorithm Hash digest
SHA256 e237c95bd35b8543bec3f78fc10f4ca9e7e6448af9bbd3586fa2b3b21d4f5e4b
MD5 d87ff62c18e680eb1e407ff1a89a9986
BLAKE2b-256 4b401776f16a7b3598836930b2733db664ae6d0b4944af26cdc086c3b477a816

See more details on using hashes here.

File details

Details for the file mincss-0.8.3-py27-none-any.whl.

File metadata

File hashes

Hashes for mincss-0.8.3-py27-none-any.whl
Algorithm Hash digest
SHA256 86b3befa878e5a6f4495cc6b1ffe5ebde067c3192606d19349957a3a8b90d5a4
MD5 52bbbfa2e9b12b57394d70081b8660f3
BLAKE2b-256 896a7746bdedce8e5170c2e52e78fa7b178c839e42f808946a5bd0544b0dc62e

See more details on using hashes here.

File details

Details for the file mincss-0.8.3-py3-none-any.whl.

File metadata

File hashes

Hashes for mincss-0.8.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a3c6ba9e8d93ff0572aa546eb43e30afe6b5de6ce7ac1c221a799901e72ab1ce
MD5 ecff4216bdd06fa2cd66e886fd75cf38
BLAKE2b-256 0549b2e106a388c1b21bfdb3b98488536b6f7eec15cd314ac83f4fe5e9a69bee

See more details on using hashes here.

Supported by

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