Skip to main content

mincss

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.

Metadata

Release files for mincss 0.8.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mincss 0.8.6
File Size Uploaded
mincss-0.8.6.tar.gz 11.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for mincss 0.8.6
File Interpreter ABI Platform
mincss-0.8.6-py3-none-any.whl Python 3 none any Details
mincss-0.8.6-py2-none-any.whl Python 2 none any Details

Total release size: 36.1 kB

Release files / mincss-0.8.6.tar.gz

Download URL mincss-0.8.6.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f0513e6e28cebb8299e7cc1c44d165513fa512ed085714a57703622d3ca76ef2
BLAKE2b-256 checksum
How to use checksums
2676d6b6233d36f01cc18662c66bc205a1c81489cc3509920f512e8372ab301d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / mincss-0.8.6-py3-none-any.whl

Download URL mincss-0.8.6-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fffcca063d31169d7da7e23b3c001ef7f314cefb204650922172d6d3655249bf
BLAKE2b-256 checksum
How to use checksums
f545e242f448bf400eb91c4726eff52192e5ebdf47778ac8175afa8cdb4c4252
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / mincss-0.8.6-py2-none-any.whl

Download URL mincss-0.8.6-py2-none-any.whl
Size 12.5 kB
Tags Python 2
SHA-256 checksum
How to use checksums
2cd278f9d0ffa76e07fc3a12f99256c662e98580f27dcaf9ea67f2f4ed8c7694
BLAKE2b-256 checksum
How to use checksums
7a3ef6540344c5d7b8c693052c430ea1aea72bf071758031d3a9291ded972f5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.11.5

3 release files

0.11.3

3 release files

0.11.1

3 release files

0.11.0

3 release files

0.10.0

3 release files

0.9.0

3 release files

This release

0.8.6 This release

3 release files

0.8.5

3 release files

0.8.4

2 release files

0.8.3

3 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

1 release file

0.7.0

1 release file

0.6.1

1 release file

0.6.0

1 release file

0.5.0

1 release file

0.4.1

1 release file

0.4

1 release file

0.3

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page