A Django app useful for inlining CSS (primarily for e-mails)
Project description
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 2.7+,3.4+
- Django 1.11+
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
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.
Project details
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
File details
Details for the file django-inlinecss-0.3.0.tar.gz
.
File metadata
- Download URL: django-inlinecss-0.3.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/2.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a014278b017a07d9d0babe2bf1bc75a52e184fb0ed26e333e8ff0d8e777b9e2 |
|
MD5 | c3a0aa01a10fc131aadd7da8e6223365 |
|
BLAKE2b-256 | c2d7fca167ea93f70185d6689df40aac136f0001d71d84ccc34151812c024b3b |
Provenance
File details
Details for the file django_inlinecss-0.3.0-py2.py3-none-any.whl
.
File metadata
- Download URL: django_inlinecss-0.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/2.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eddcb295a35fcddf4fce26f9c232c472a9283b954aaf084641d0718415bd694b |
|
MD5 | 98f763bfb385a48216d983aff63791a7 |
|
BLAKE2b-256 | c91c5d5e2c2bffff1e11cc7c7bf5d36cdf8e31d0c6ac36a528561ae815807238 |