csscompressor is a Python port of the YUI CSS Compressor, designed to minify CSS code by removing unnecessary whitespace, comments, and optimizing various CSS properties. It aims to be an almost exact port, passing all original YUI unittests. The current version, 0.9.5, was last released on November 26, 2017, indicating an infrequent release cadence.
pip install csscompressorVerified import paths — ran on the pinned version, not inferred.
Compress a CSS string by importing the `compress` function and passing the raw CSS code to it.
Consider evaluating alternative, more actively maintained CSS minification libraries if up-to-date CSS standard support and ongoing bug fixes are critical. For basic compression, it may still be sufficient.
Thoroughly test compressed CSS output, especially for complex or modern CSS syntax. Manually inspect the output for any visual regressions or parsing errors in target browsers. Report specific issues to the GitHub repository if not already documented.
Compare the compression ratio and output quality against other Python CSS minifiers (e.g., `rcssmin` which Django Compressor now uses) if maximum file size reduction is a primary goal. Benchmarking may be necessary for critical performance applications.
Install the package using pip: `pip install csscompressor`
Ensure you are using a Python 3 compatible version of the library. If the issue persists with the latest version (0.9.5), it indicates an internal incompatibility or an attempt to use Python 2 specific code. The library states compatibility with Python 2.7 and 3.3+, so updating your `csscompressor` version via `pip install --upgrade csscompressor` might resolve it, or manually replace `xrange` with `range` in a local copy if it's within your own project's older helper code.
This is often a compatibility issue between `django-compressor` and `Django`'s `staticfiles`. Ensure that `django-compressor` and Django are compatible versions. If `csscompressor` is a dependency of `django-compressor`, check if updating `django-compressor` (and its dependencies, including `csscompressor`) resolves the conflict.
Pin your `BeautifulSoup4` dependency to an older, compatible version (e.g., `beautifulsoup4==4.12.3`) or check for a newer version of `csscompressor` (or `django-compressor`) that has addressed this compatibility break.
No dependency data recorded yet.