Py Style Flattener
Introduction
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
Installation
pip install py_style_flattener
Usage
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)
Current limitations:
- 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
Contributing
build & release
pip install build twine
python -m build
python -m twine upload --config-file .pypirc dist/*
Metadata
Release files for py-style-flattener 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py_style_flattener-0.0.3.tar.gz | 16.1 kB | Without provenance | Details for py_style_flattener-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_style_flattener-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for py_style_flattener-0.0.3-py3-none-any.whl |
Total release size: 32.7 kB
Release files / py_style_flattener-0.0.3.tar.gz
| Download URL | py_style_flattener-0.0.3.tar.gz |
|---|---|
| Size | 16.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e92994d5c11c0dc217f96c95d71cfacaa3ef1119ead39c3fae918074d90f46d7
|
|
BLAKE2b-256 checksum How to use checksums |
e9b0c323856d57c6e0a31e033089cca4198deb8e81829b65bf3b72633070ca36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.11
|
Release files / py_style_flattener-0.0.3-py3-none-any.whl
| Download URL | py_style_flattener-0.0.3-py3-none-any.whl |
|---|---|
| Size | 16.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2a88aa1df6f27c6dd8eb0bbefc97b8dad082a53297d24d361de1d770b5c62a50
|
|
BLAKE2b-256 checksum How to use checksums |
883ce0121e7b3eaf4885ca11f796a9bb5c1609359697c449e422dc793c7d15e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.11
|
Security for py-style-flattener 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.