{ "info": { "author": "Massimiliano Torromeo", "author_email": "massimiliano.torromeo@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: BSD License", "Programming Language :: Python" ], "description": "CleanCSS\n--------\n\nCleanCSS is a simple pythonic language for CSS inspired by\n`CleverCSS `_ but simpler and with less\nobstrusive features.\n\nWhy\n---\nI really liked the idea behind CleverCSS but when used in production I realized\nthat I was trying to get away from its parser by escaping strings and unsupported\nCSS properties way too often. Using vendor prefixes like -webkit-gradient and\nvalues such as rgba resulted in a messy CSS, so I decided to write my own parser\nfor a similar syntax without all the complex features that I did not use anyway\nand it now works fine for me in REAL modern websites.\n\nSyntax examples\n---------------\n\nI'm going to keep the CleverCSS examples where possible since the syntax is really\nsimilar.\n\nA small example below. Note the indentation based syntax and how you can nest rules::\n\n\t#header, #footer:\n\t\tmargin: 0\n\t\tpadding: 0\n\t\tfont->\n\t\t\tfamily: Verdana, sans-serif\n\t\t\tsize: .9em\n\n\t\tli:\n\t\t\tpadding: 0.4em\n\t\t\tmargin: 0.8em 0 0.8em\n\n\t\t\th3:\n\t\t\t\tfont-size: 1.2em\n\t\t\tp:\n\t\t\t\tpadding: 0.3em\n\t\t\tp.meta:\n\t\t\t\ttext-align: right\n\t\t\t\tcolor: #ddd\n\nOf course you can do the very same in CSS, but because of its flat nature the\ncode would look more verbose. The following piece of code is the CleanCSS\noutput of the above file::\n\n\t#header, #footer {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\tfont-family: Verdana, sans-serif\n\t\tfont-size: .9em\n\t}\n\n\t#header li,\n\t#footer li {\n\t\tpadding: 0.4em;\n\t\tmargin: 0.8em 0 0.8em;\n\t}\n\n\t#header li h3,\n\t#footer li h3 {\n\t\tfont-size: 1.2em;\n\t}\n\n\t#header li p,\n\t#footer li p {\n\t\tpadding: 0.3em;\n\t}\n\n\t#header li p.meta,\n\t#footer li p.meta {\n\t\ttext-align: right;\n\t\tcolor: #dddddd;\n\t}\n\nCallbacks\n---------\nStarting with version 1.4 CleanCSS supports user callbacks to alter the resulting stylesheet.\nThe callback function receives the property name and its value and should return a list of property-value pairs to insert in the generated CSS.\n\nExample::\n\n\timport cleancss\n\n\tdef callback(prop, value):\n\t\trules = []\n\n\t\t# Include the unaltered rule\n\t\trules.append( (prop, value) )\n\n\t\t# Include a variant of the rule\n\t\trules.append( (\"-moz-\"+prop, value) )\n\n\t\treturn rules\n\n\twith open('file.ccss') as f:\n\t\tprint cleancss.convert(f, callback)\n\nThe library already includes a callback function that can be used to convert between the most common browser variants\n\nExample::\n\n\timport cleancss\n\n\twith open('file.ccss') as f:\n\t\tprint cleancss.convert(f, cleancss.callbacks.browser_variants)\n\nLibrary usage\n-------------\nImport the cleancss module and call the convert() function with a file-like object.\n\nExample::\n\n\timport cleancss\n\twith open('file.ccss') as f:\n\t\tprint cleancss.convert(f)\n\nCommand line usage\n------------------\nCall the cleancss.py without parameters to show the usage instructions.\nPass any number of files to cleancss.py and the script will convert the files to CSS\nand print the result to the console.\n\nExample::\n\n\tpython -m cleancss file.ccss > result.css\n\nLICENSE\n-------\nCopyright (c) 2010 Massimiliano Torromeo\n\nCleanCSS is free software released under the terms of the BSD license.\n\nSee the LICENSE file provided with the source distribution for full details.\n\nContacts\n--------\n\n* Massimiliano Torromeo ", "description_content_type": null, "docs_url": null, "download_url": "http://github.com/mtorromeo/py-cleancss/tarball/v1.4", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/mtorromeo/py-cleancss/", "keywords": "css", "license": "BSD License", "maintainer": null, "maintainer_email": null, "name": "CleanCSS", "package_url": "https://pypi.org/project/CleanCSS/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/CleanCSS/", "project_urls": { "Download": "http://github.com/mtorromeo/py-cleancss/tarball/v1.4", "Homepage": "http://github.com/mtorromeo/py-cleancss/" }, "release_url": "https://pypi.org/project/CleanCSS/1.4/", "requires_dist": null, "requires_python": null, "summary": "Pythonic markup for css", "version": "1.4" }, "last_serial": 677518, "releases": { "1.3": [ { "comment_text": "", "digests": { "md5": "4fcc34e6a85dafec4b82754474b161e4", "sha256": "8627ff613e21c8b534a722424b71bb6af275476a50964adc73cd772ae2c30736" }, "downloads": -1, "filename": "CleanCSS-1.3.tar.gz", "has_sig": false, "md5_digest": "4fcc34e6a85dafec4b82754474b161e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3428, "upload_time": "2010-04-29T17:13:38", "url": "https://files.pythonhosted.org/packages/31/34/0d05f255e7fa5169934029e8b6a04df827a9d5b2e2bfbae8c33d349813f1/CleanCSS-1.3.tar.gz" }, { "comment_text": "", "digests": { "md5": "e643e96538b475229a3b15bb8ee17baf", "sha256": "175391dbd558110edd8925b982a9ff2e2e9720054ceaf74cf352c46a9d3d4606" }, "downloads": -1, "filename": "CleanCSS-1.3.zip", "has_sig": false, "md5_digest": "e643e96538b475229a3b15bb8ee17baf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5007, "upload_time": "2010-04-29T17:13:39", "url": "https://files.pythonhosted.org/packages/79/25/a1894ad1fab4a641f2a1151e3fcdc1409c3526a47ac2c52a4327998e9bf2/CleanCSS-1.3.zip" } ], "1.4": [ { "comment_text": "", "digests": { "md5": "b8d49b2c2a160fb688379c94a4c4f63c", "sha256": "2cd98202ba17d4b575ccfccc419a41818b763162f37825f361186d3818d7d93b" }, "downloads": -1, "filename": "CleanCSS-1.4.tar.gz", "has_sig": false, "md5_digest": "b8d49b2c2a160fb688379c94a4c4f63c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4799, "upload_time": "2011-04-18T14:11:13", "url": "https://files.pythonhosted.org/packages/44/19/874ab765ea55a4b66f9a6bb3656b1c2df8fcae29e3f9c0e8b6cb5edae9ae/CleanCSS-1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b8d49b2c2a160fb688379c94a4c4f63c", "sha256": "2cd98202ba17d4b575ccfccc419a41818b763162f37825f361186d3818d7d93b" }, "downloads": -1, "filename": "CleanCSS-1.4.tar.gz", "has_sig": false, "md5_digest": "b8d49b2c2a160fb688379c94a4c4f63c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4799, "upload_time": "2011-04-18T14:11:13", "url": "https://files.pythonhosted.org/packages/44/19/874ab765ea55a4b66f9a6bb3656b1c2df8fcae29e3f9c0e8b6cb5edae9ae/CleanCSS-1.4.tar.gz" } ] }