About
Inlining CSS is necessary for email generation and sending but is currently a surprisingly large hassle.
This library aims to make it a breeze in the Django template language.
Usage
Step 1: Dependencies
- BeautifulSoup
- cssutils
- Python 3.6+
- Django 2.2+
Step 2: Install django_inlinecss
Add django_inlinecss to your settings.py:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.webdesign',
'django.contrib.contenttypes',
'...',
'...',
'...',
'django_inlinecss')
Step 3: Use the templatetag
- Place your CSS file somewhere staticfiles can find it
- Create your template:
{% load inlinecss %}
{% inlinecss "css/extra-padding.css" %}
<html>
<body>
<div class='lots-o-padding'>
Something in need of styling.
</div>
</body>
</html>
{% endinlinecss %}
Step 4: Prepare to be Wowed
<html>
<body>
<div style="padding-left: 10px; padding-right: 10px; padding-top: 10px;" class="lots-o-padding">
Something in need of styling.
</div>
</body>
</html>
Acknowledgements
This is a fork of django-inlinecss, with updates for newer versions of Python and Django.
Thanks to Tanner Netterville for his efforts on Pynliner.
Thanks to Thomas Yip for his unit tests on the soupselect module. These tests
helped on getting the core CSS2 selectors to work.
License
MIT license. See LICENSE.md for more detail.
Metadata
Release files for django-inlinecss-redux 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-inlinecss-redux-0.4.0.tar.gz | 12.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_inlinecss_redux-0.4.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 25.6 kB
Release files / django-inlinecss-redux-0.4.0.tar.gz
| Download URL | django-inlinecss-redux-0.4.0.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3373cb2c7cf8b51b79cc201be2c62991e431c0dfb4067ca871f3fcd2a2da59c8
|
|
BLAKE2b-256 checksum How to use checksums |
d8ad692e2e0e615118f76918118b16ec05a48b91f98ae477d417576bcc2d74c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
|
Release files / django_inlinecss_redux-0.4.0-py2.py3-none-any.whl
| Download URL | django_inlinecss_redux-0.4.0-py2.py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
5e6201946264815d9f22fd7f4f3fde7a4bb85ecfc62ce542d4920d0a7d562cb7
|
|
BLAKE2b-256 checksum How to use checksums |
46b1298f9275a87f8f29581e50d9977413c1ef7a612f6a9555ec81d2cca2492e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
|