# cssfix
**cssfix** is a lightweight Python utility that cleans and optimizes your CSS code.
It removes comments 🗑️, merges duplicate selectors 🧩, and outputs a compact result ⚡.
Perfect for small projects, automation, or integrating into build tools.
---
## ✨ Features
- 🧽 **Removes all CSS comments**
- 🔁 **Merges repeated selectors** (e.g. `.class1 {}` multiple times)
- 🧠 **Consolidates CSS properties without duplicates**
- 📥 **Takes raw CSS string as input**
- 📤 **Returns optimized CSS string output immediately on instantiation**
- 🐍 **Pure Python - no dependencies**
---
## 📦 Installation
From PyPI:
```cmd
pip install cssfix
```
---
## 🚀 Usage
```python
from cssfix import css
css_text = """
/* This is a comment */
.box {
color: red;
}
.box {
background: blue;
}
"""
optimized_css = css(css_text)
print(optimized_css)
```
### ✅ Output:
```css
.box{color:red;background:blue;}
```
---
## 📚 API
```python
class css(css_text: str)
```
Creates a new instance of the CSS optimizer and immediately returns optimized CSS string.
#### Parameters:
> `css_text`: `str` — Raw CSS code to optimize
#### Returns:
> `str` — Optimized, minified CSS with merged selectors and no comments
Raw data
{
"_id": null,
"home_page": "https://github.com/seekiii/cssfix",
"name": "cssfix",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "css optimizer cssfix css merge",
"author": "seekii",
"author_email": "seekii.official@example.com",
"download_url": "https://files.pythonhosted.org/packages/1d/36/f62e46584aa4357cab3bc21ae5b7682218a33bd74765273479cab7ee14f7/cssfix-2.1.0.tar.gz",
"platform": null,
"description": "# cssfix\r\n\r\n**cssfix** is a lightweight Python utility that cleans and optimizes your CSS code. \r\nIt removes comments \ud83d\uddd1\ufe0f, merges duplicate selectors \ud83e\udde9, and outputs a compact result \u26a1. \r\nPerfect for small projects, automation, or integrating into build tools.\r\n\r\n---\r\n\r\n## \u2728 Features\r\n\r\n- \ud83e\uddfd **Removes all CSS comments**\r\n- \ud83d\udd01 **Merges repeated selectors** (e.g. `.class1 {}` multiple times)\r\n- \ud83e\udde0 **Consolidates CSS properties without duplicates**\r\n- \ud83d\udce5 **Takes raw CSS string as input**\r\n- \ud83d\udce4 **Returns optimized CSS string output immediately on instantiation**\r\n- \ud83d\udc0d **Pure Python - no dependencies**\r\n\r\n---\r\n\r\n## \ud83d\udce6 Installation\r\n\r\nFrom PyPI:\r\n```cmd\r\npip install cssfix\r\n```\r\n---\r\n\r\n## \ud83d\ude80 Usage\r\n```python\r\nfrom cssfix import css\r\n\r\ncss_text = \"\"\"\r\n/* This is a comment */\r\n.box {\r\n\tcolor: red;\r\n}\r\n.box {\r\n\tbackground: blue;\r\n}\r\n\"\"\"\r\n\r\noptimized_css = css(css_text)\r\nprint(optimized_css)\r\n```\r\n### \u2705 Output:\r\n```css\r\n.box{color:red;background:blue;}\r\n```\r\n---\r\n\r\n## \ud83d\udcda API\r\n\r\n```python\r\nclass css(css_text: str)\r\n```\r\n\r\nCreates a new instance of the CSS optimizer and immediately returns optimized CSS string.\r\n\r\n#### Parameters:\r\n> `css_text`: `str` \u2014 Raw CSS code to optimize\r\n\r\n#### Returns:\r\n> `str` \u2014 Optimized, minified CSS with merged selectors and no comments\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Simple CSS optimizer module for merging class properties",
"version": "2.1.0",
"project_urls": {
"Homepage": "https://github.com/seekiii/cssfix"
},
"split_keywords": [
"css",
"optimizer",
"cssfix",
"css",
"merge"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "dba0d081b2a1283e93559d0d59fbe82cd73b120f04e4c5703ba610a894967e52",
"md5": "4df830ee867a4481276f94433619dc9d",
"sha256": "3f1b50d645c95c95b556723be87b7aa7268b4575ec0e0ac8a757e141c6ffb47c"
},
"downloads": -1,
"filename": "cssfix-2.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4df830ee867a4481276f94433619dc9d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 3776,
"upload_time": "2025-07-27T08:44:30",
"upload_time_iso_8601": "2025-07-27T08:44:30.146992Z",
"url": "https://files.pythonhosted.org/packages/db/a0/d081b2a1283e93559d0d59fbe82cd73b120f04e4c5703ba610a894967e52/cssfix-2.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1d36f62e46584aa4357cab3bc21ae5b7682218a33bd74765273479cab7ee14f7",
"md5": "0906316965cff926ea1feceeca7e6589",
"sha256": "1c9a6579c84051a78772b0e946485152e064b063c23e8f97a97c6b37c47ebabf"
},
"downloads": -1,
"filename": "cssfix-2.1.0.tar.gz",
"has_sig": false,
"md5_digest": "0906316965cff926ea1feceeca7e6589",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 3582,
"upload_time": "2025-07-27T08:44:31",
"upload_time_iso_8601": "2025-07-27T08:44:31.491934Z",
"url": "https://files.pythonhosted.org/packages/1d/36/f62e46584aa4357cab3bc21ae5b7682218a33bd74765273479cab7ee14f7/cssfix-2.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-27 08:44:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "seekiii",
"github_project": "cssfix",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "cssfix"
}