csscompress
A fast and safe CSS minifier for Python — the community-maintained fork of
csscompressor (itself a Python
port of YUI Compressor's CSS minifier).
What's fixed vs upstream
Upstream csscompressor is dormant (last release 0.9.5, November 2017). csscompress
continues it with:
- Data-URI whitespace fix:
url("data:...")values containing SVG or MathML were minified aggressively (remove_ws=True), destroying the whitespace that SVG/MathML data URIs need to render.csscompresspreserves whitespace insideurl(...)patterns, sodata:image/svg+xml,...CSS works after minification. - Proper
__version__attribute (upstream shipped a stale one).
Usage
from csscompress import compress
minified = compress("body { color: #ff0000; /* comment */ }")
There is also a CLI:
$ python -m csscompress input.css > output.min.css
API
compress(css: str) -> str— minify a CSS stylesheet.compress_partitioned(css: str) -> list[str]— minify and return each top-level rule separately.
License
BSD (revised) — see LICENSE. The original project is a Python port of the
YUI Compressor CSS minifier:
- Portions Copyright (c) 2013 Sprymix Inc.
- Author of the Python port: Yury Selivanov
- Original authors: Julien Lecomte, Isaac Schlueter, Stoyan Stefanov, and contributors; Portions Copyright (c) 2011-2013 Yahoo! Inc.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file csscompress-0.1.0.tar.gz.
File metadata
- Download URL: csscompress-0.1.0.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e87e0d26bd904b8c544d1ca3327a9fa99ae61ce72d04153e0e7fe9fe1179cca
|
|
| MD5 |
9a05d4cc6501ee5ec77e7a530477d77b
|
|
| BLAKE2b-256 |
8d31eb99ae11fec861cc99bbaaacde146c3cc88db963d7f29f6ea0f493caee16
|
Provenance
The following attestation bundles were made for csscompress-0.1.0.tar.gz:
Publisher:
release.yml on QQSHI13/csscompress
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
csscompress-0.1.0.tar.gz -
Subject digest:
9e87e0d26bd904b8c544d1ca3327a9fa99ae61ce72d04153e0e7fe9fe1179cca - Sigstore transparency entry: 2446220142
- Sigstore integration time:
-
Permalink:
QQSHI13/csscompress@d1212ba1aa0f71504590cb94efc299a79adecbcb -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/QQSHI13
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d1212ba1aa0f71504590cb94efc299a79adecbcb -
Trigger Event:
push
-
Statement type:
File details
Details for the file csscompress-0.1.0-py3-none-any.whl.
File metadata
- Download URL: csscompress-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8977d6fac07954778d6ffaa83ee23edd66391dcd61f01d97448e708b863a2be7
|
|
| MD5 |
322ae25e8147a5db0a474965f27a2595
|
|
| BLAKE2b-256 |
b54a3a50aa62cffdcc7c90a36e3eb1095b462966de85a0d43108cdeae2075350
|
Provenance
The following attestation bundles were made for csscompress-0.1.0-py3-none-any.whl:
Publisher:
release.yml on QQSHI13/csscompress
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
csscompress-0.1.0-py3-none-any.whl -
Subject digest:
8977d6fac07954778d6ffaa83ee23edd66391dcd61f01d97448e708b863a2be7 - Sigstore transparency entry: 2446220334
- Sigstore integration time:
-
Permalink:
QQSHI13/csscompress@d1212ba1aa0f71504590cb94efc299a79adecbcb -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/QQSHI13
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d1212ba1aa0f71504590cb94efc299a79adecbcb -
Trigger Event:
push
-
Statement type: