Skip to main content

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

Project description

[![Build Status](https://travis-ci.org/roverdotcom/django-inlinecss.png?branch=master)](https://travis-ci.org/roverdotcom/django-inlinecss)

## 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.6+


#### Step 2: Install django_inlinecss

Add ```django_inlinecss``` to your ```settings.py```:

```python
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:

```html
{% 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
<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](https://github.com/rennat/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.1.3.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

django_inlinecss_redux-0.1.3-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for django-inlinecss-redux-0.1.3.tar.gz
Algorithm Hash digest
SHA256 98960ab8b5ea15f2ef391d59da0263e0cce6499a4c9a1c400f3681ef3e698bae
MD5 a0aa2821b225cd801b1cd64049f0a1ee
BLAKE2b-256 1c4b27ae3149acfefd65aeeee4781375d9a6f26ef1dbf25d0851470bcb35d49a

See more details on using hashes here.

File details

Details for the file django_inlinecss_redux-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for django_inlinecss_redux-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e2d3ab624aaf0288a20e90f366de1e274bdf49c4dd58f90de82a48f6839692e2
MD5 44e733e56cba872bec535e8d0ce3616c
BLAKE2b-256 b725ec4b89d0d12e13695ae310836b5b43bfe0aa008700989ec649988103a9ce

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