Skip to main content

A Django app useful for inlining CSS (primarily for e-mails)

Project description

Build Status

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

  1. Place your CSS file somewhere staticfiles can find it
  2. 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.

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

django-inlinecss-redux-0.4.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

django_inlinecss_redux-0.4.0-py2.py3-none-any.whl (13.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-inlinecss-redux-0.4.0.tar.gz.

File metadata

  • Download URL: django-inlinecss-redux-0.4.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for django-inlinecss-redux-0.4.0.tar.gz
Algorithm Hash digest
SHA256 3373cb2c7cf8b51b79cc201be2c62991e431c0dfb4067ca871f3fcd2a2da59c8
MD5 17dc2e89c0501c6dcce38f24314feba6
BLAKE2b-256 d8ad692e2e0e615118f76918118b16ec05a48b91f98ae477d417576bcc2d74c7

See more details on using hashes here.

File details

Details for the file django_inlinecss_redux-0.4.0-py2.py3-none-any.whl.

File metadata

  • Download URL: django_inlinecss_redux-0.4.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using 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

File hashes

Hashes for django_inlinecss_redux-0.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5e6201946264815d9f22fd7f4f3fde7a4bb85ecfc62ce542d4920d0a7d562cb7
MD5 db173b027fd2b5f304d5a1dc99c22524
BLAKE2b-256 46b1298f9275a87f8f29581e50d9977413c1ef7a612f6a9555ec81d2cca2492e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page