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.6.tar.gz (11.1 kB view details)

Uploaded Source

Built Distributions

mincss-0.8.6-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

mincss-0.8.6-py2-none-any.whl (12.5 kB view details)

Uploaded Python 2

File details

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

File metadata

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

File hashes

Hashes for mincss-0.8.6.tar.gz
Algorithm Hash digest
SHA256 f0513e6e28cebb8299e7cc1c44d165513fa512ed085714a57703622d3ca76ef2
MD5 2f5de66d6ab4426c5a8ca47be1fab7b4
BLAKE2b-256 2676d6b6233d36f01cc18662c66bc205a1c81489cc3509920f512e8372ab301d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mincss-0.8.6-py3-none-any.whl
Algorithm Hash digest
SHA256 fffcca063d31169d7da7e23b3c001ef7f314cefb204650922172d6d3655249bf
MD5 11860cf17e1ceedec1cc75deecf1be32
BLAKE2b-256 f545e242f448bf400eb91c4726eff52192e5ebdf47778ac8175afa8cdb4c4252

See more details on using hashes here.

File details

Details for the file mincss-0.8.6-py2-none-any.whl.

File metadata

File hashes

Hashes for mincss-0.8.6-py2-none-any.whl
Algorithm Hash digest
SHA256 2cd278f9d0ffa76e07fc3a12f99256c662e98580f27dcaf9ea67f2f4ed8c7694
MD5 b25a2a39de6cb5b1df4ef75cf54f1ea0
BLAKE2b-256 7a3ef6540344c5d7b8c693052c430ea1aea72bf071758031d3a9291ded972f5a

See more details on using hashes here.

Supported by

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