{ "info": { "author": "Juan Carlos", "author_email": "juancarlospaco@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Environment :: Other Environment", "Intended Audience :: Developers", "Intended Audience :: Other Audience", "License :: OSI Approved :: GNU General Public License (GPL)", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)", "Natural Language :: English", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: OS Independent", "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Software Development" ], "description": "# css-html-js-minify\n\nAsync single-file cross-platform no-dependencies Minifier for the Web. [](http://opensource.org/licenses/GPL-3.0) [](http://opensource.org/licenses/LGPL-3.0) [](http://python.org) [](https://travis-ci.org/juancarlospaco/css-html-js-minify)\n\n\n\n\nhttps://pypi.python.org/pypi/css-html-js-minify\n\n```shell\ncss-html-js-minify.py --help\n\nusage: css-html-js-minify.py [-h] [--version] [--wrap] [--prefix PREFIX]\n [--timestamp] [--quiet] [--hash] [--zipy]\n [--sort] [--comments] [--overwrite]\n [--after AFTER] [--before BEFORE] [--watch]\n [--multiple] [--beep]\n fullpath\n\nCSS-HTML-JS-Minify. StandAlone Async cross-platform Unicode-ready Python3-ready Minifier for the Web.\n\npositional arguments:\n fullpath Full path to local file or folder.\n\noptional arguments:\n -h, --help show this help message and exit\n --version show programs version number and exit\n --wrap Wrap output to ~80 chars per line, CSS only.\n --prefix PREFIX Prefix string to prepend on output filenames.\n --timestamp Add a Time Stamp on all CSS/JS output files.\n --quiet Quiet, Silent, force disable all logging.\n --hash Add SHA1 HEX-Digest 11chars Hash to Filenames.\n --zipy GZIP Minified files as '*.gz', CSS/JS only.\n --sort Alphabetically Sort CSS Properties, CSS only.\n --comments Keep comments, CSS/HTML only (Not Recommended)\n --overwrite Force overwrite all in-place (Not Recommended)\n --after AFTER Command to execute after run (Experimental).\n --before BEFORE Command to execute before run (Experimental).\n --watch Re-Compress if file changes (Experimental).\n --multiple Allow Multiple instances (Not Recommended).\n\nCSS-HTML-JS-Minify: Takes a file or folder full path string and process all\nCSS/HTML/JS found. If argument is not file/folder will fail. Check Updates\nworks on Python3. Std-In to Std-Out is deprecated since it may fail with\nunicode characters. SHA1 HEX-Digest 11 Chars Hash on Filenames is used for\nServer Cache. CSS Properties are Alpha-Sorted, to help spot cloned ones,\nSelectors not. Watch works for whole folders, with minimum of ~60 Secs between\nruns.\n\n```\n\n- Takes a full path to anything, a file or a folder, then parse, optimize and compress for Production.\n- If full path is a folder with multiple files it will use Async Multiprocessing.\n- Pretty-Printed colored Logging to Standard Output and Log File on OS Temporary Folder.\n- Set its own Process name and show up on Process lists.\n- Can check for updates for itself.\n- Full Unicode/UTF-8 support.\n- Smooth CPU usage, Single Instance Checking.\n- Can Obfuscate, GZIP and Hash files, also Watch for changes on files.\n- Can execute arbitrary commands after and before running.\n- `*.css` files are saved as `*.min.css`, `*.js` are saved as `*.min.js`, `*.htm` are saved as `*.html`\n\n\n# Screenshots\n\n**Linux:**\n\n\n\n**Apple Mac Os X:**\n[ *(Provided by Loggerhead)* ](https://github.com/juancarlospaco/css-html-js-minify/issues/7#issuecomment-97280835)\n\n\n\n\n**MS Windows:**\n\n\n\n\n# Command-line usage\n\n```bash\ncss-html-js-minify.py file.htm\n\ncss-html-js-minify.py file.css\n\ncss-html-js-minify.py file.js\n\ncss-html-js-minify.py /project/static/\n```\n\n# Python code usage\n\n```python\nfrom css_html_js_minify import process_single_html_file, process_single_js_file, process_single_css_file, html_minify, js_minify, css_minify\n\nprocess_single_html_file('test.htm', overwrite=False)\n# 'test.html'\nprocess_single_js_file('test.js', overwrite=False)\n# 'test.min.js'\nprocess_single_css_file('test.css', overwrite=False)\n# 'test.min.css'\n\nhtml_minify('
yoloo
')\n# 'yoloo
'\njs_minify('var i = 1; i += 2 ;\\n alert( \"hello \" ); //hi')\n# 'var i=1;i+=2;alert(\"hello \");'\ncss_minify('body {width: 50px;}\\np {margin-top: 1em;/* hi */ }', comments=False)\n# '@charset utf-8;body{width:50px}p{margin-top:1em}'\n```\n\nThe optional arguments that these functions take are almost the same as the command-line flags.\nCheck the list above *(just use add_hash instead of hash)*. Additionally, you can force a specific path for the output files using ``output_path``.\n\n\n# Install\n\n```\npip install css-html-js-minify\n```\nUninstall `pip uninstall css-html-js-minify`\n\n\n# Why?\n\n- **Why another Compressor ?**, there are lots of compressors for web files out there!; *Or maybe not ?*.\n- Many of them only work inside Django/Flask, or frameworks of PHP/Java/Ruby, or can not process whole folders.\n- This project is the big brother of another project that does the inverse, a [Beautifier for the Web.](https://github.com/juancarlospaco/css-html-prettify#css-html-prettify)\n\n\n# Migration\n\nTo keep things simple [KISS](http://en.wikipedia.org/wiki/KISS_principle), the human readable indented commented hackable HTML is kept as `*.htm` and the compressed production-ready as `*.html`. This is inspired from JavaScript/CSS `*.min.js` and `*.min.css`. [We did not \"invent\" this file extension.](http://en.wikipedia.org/wiki/HTM)\n\nTo migrate from typical file extension HTML to HTM, which is the exactly same, you can run this:\n\n```shell\nfind . -name \"*.html\" -exec rename \"s/.html/.htm/\" \"{}\" \\;\n```\n\nThis will make a copy of all `*.html` renaming them as `*.htm` recursively from the current folder. Nothing deleted.\n\n\n# Requisites\n\n- [Python 3.6+](https://www.python.org \"Python Homepage\")\n\n\n# Coding Style Guide\n\n- Lint, [PEP-8](https://www.python.org/dev/peps/pep-0008), [PEP-257](https://www.python.org/dev/peps/pep-0257), [iSort](https://github.com/timothycrosley/isort) must Pass Ok. `pip install pep8 isort`\n- If there are any kind of tests, they must pass. No tests is also acceptable, but having tests is better.\n\n\n# JavaScript support\n\n- ES6 and ES7 and future standards may not be fully supported since they change quickly, mainly driven by Node.JS releases.\n- Future JavaScript support is orphan, if you want to make ES6, ES7 work feel free to send pull request, we will merge it.\n\n\n# Contributors\n\n- **Please Star this Repo on Github !**, it helps to show up faster on searchs.\n- [Help](https://help.github.com/articles/using-pull-requests) and more [Help](https://help.github.com/articles/fork-a-repo) and Interactive Quick [Git Tutorial](https://try.github.io).\n\n\n# Licence\n\n- GNU GPL and GNU LGPL and [MIT](https://github.com/juancarlospaco/css-html-js-minify/issues/65#issuecomment-330983569).\n\nThis work is free software:\nYou can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\nThis work is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;\nWithout even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.\nYou should have received a copy of the GNU General Public License along with this work.\n\n\n# Example\n\n