{"id":4916,"library":"csscompressor","title":"CSS Compressor","description":"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.","status":"maintenance","version":"0.9.5","language":"en","source_language":"en","source_url":"https://github.com/sprymix/csscompressor","tags":["css","compression","minify","yui"],"install":[{"cmd":"pip install csscompressor","lang":"bash","label":"Install with pip"}],"dependencies":[],"imports":[{"symbol":"compress","correct":"from csscompressor import compress"}],"quickstart":{"code":"from csscompressor import compress\n\ncss_input = '''\nyour css {\n  /* a comment */\n  content: \"!\";\n  margin-left: 0px;\n  color: #AABBCC;\n}\n'''\n\ncompressed_css = compress(css_input)\nprint(compressed_css)\n# Expected output: 'your css{content:\"!\";margin-left:0;color:#ABC}'","lang":"python","description":"Compress a CSS string by importing the `compress` function and passing the raw CSS code to it."},"warnings":[{"fix":"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.","message":"The library's last release was in November 2017. This suggests it is no longer actively maintained, which could mean a lack of updates for newer CSS features, unaddressed bugs, or limited community support.","severity":"gotcha","affected_versions":"<=0.9.5"},{"fix":"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.","message":"Known issues exist regarding incorrect whitespace removal in specific CSS contexts (e.g., with 'px' and '+' in `max` or `calc` functions), 'mysterious duplicates,' and improper whitespace handling in SVG. This can lead to malformed or non-functional CSS after compression.","severity":"gotcha","affected_versions":"0.9.5"},{"fix":"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.","message":"Being a port of YUI CSS Compressor, the library's compression algorithms might not be as aggressive or as intelligent as more modern, actively developed CSS minifiers, potentially resulting in larger output files or less optimal compression for contemporary CSS patterns.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}