This module is useful to move all the css from style tags to inline style attribute
Makes use of pyquery and regex (due to stdlib's re module not supporting recursion)
Keeps all the @font-face but removes everything else
pip install py_style_flattener
It can be used from cli:
$ py-style-flattener INPUT OUTPUT
(note that INPUT and OUTPUT can be either paths or stdin/stdout)
Or as a python module
>>> import py_style_flattener
>>> # using files, you need to open them before.
>>> py_style_flattener.using_files(INPUT, OUTPUT)
>>> # using plain strings
>>> OUTPUT = dpy_style_flattener.using_strings(INPUT)
- doesn't fetch remote style
- cannot set pseudo elements (limitation inherited from cssselect used by pyquery)
- only takes care of @media screen{} avoiding all other media queries
pip install build twine
python -m build
python -m twine upload --config-file .pypirc dist/*