A generic HTML minifier for python
Project description
This is a generic HTML minifier NOT using regular expressions. This minifier is fully HTML5 compatible.
The name is coming from the Harry Potter books and is an incantation that forces objects to shrink
This project was started because of the lack of a maintained HTML minifier not using complex regexp. This project uses beautifulsoup to navigate the HTML flow.
Install
$ pip install python-diminuendo
Usage
TODO
HTML minification
>>> from diminuendo import htmlmin
>>> html = """<html>
<head>
<title>Hello World!</title>
</head>
<body>
<p>Good morning</p>
</body>
</html>"""
>>> minified = htmlmin(html)
>>> print minified
'<html><head><title>Hello World!</title></head><body><p>Good morning</p></body></html>'
Development
Add a minification test
To add a minification test, simply add the html code as test_name.html and its minified version as test_name-minified.html in test/html.
Test
Test the package:
$ python -m unittest discover
Automatic testing in various environments:
$ tox
Release
Use bumpr to release the package:
$ bumpr -b -m
[...]
$ python setup.py sdist bdist_wheel upload
Project
Other projects
License
python-diminuendo is published under a BSD 3-clause license, see the LICENSE file distributed with the project.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for python_diminuendo-0.1.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bf6b8f35c889c9b129248c362bb5610397f347805938c4b07d6019efdabba95 |
|
MD5 | 0186997cddb37cf8db00c9a7d66e1079 |
|
BLAKE2b-256 | fead3dcdf3491831fec890994d672d6de210aaacf5a36904436a944d5319c8e8 |