一个用于python的通用html小型化器
python-diminuendo的Python项目详细描述
这是一个使用正则表达式的泛型html minifiernot。这个迷你版完全兼容HTML5。
这个名字来自哈利波特的书,是an incantation that forces objects to shrink
这个项目是因为缺少一个维护的html小型化器而启动的 不使用复杂的regexp。此项目使用beautifulsoup导航HTML流。
安装
$ pip install python-diminuendo
用法
todo
HTML缩小
>>>fromdiminuendoimporthtmlmin>>>html="""<html> <head> <title>Hello World!</title> </head> <body> <p>Good morning</p> </body> </html>""">>>minified=htmlmin(html)>>>printminified'<html><head><title>Hello World!</title></head><body><p>Good morning</p></body></html>'
开发
添加缩小测试
要添加缩小测试,只需将html代码添加为 test_name.html及其缩小版本为 test_name-minified.html在test/html中。
测试
测试包:
$ python -m unittest discover
各种环境下的自动测试:
$ tox
释放
使用保险杠释放包裹:
$ bumpr -b -m [...] $ python setup.py sdist bdist_wheel upload
许可证
python diminuendo是在bsd 3子句许可下发布的,请参见许可 随项目分发的文件。