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.
## 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
Built Distribution
File details
Details for the file django-inlinecss-redux-0.1.2.tar.gz
.
File metadata
- Download URL: django-inlinecss-redux-0.1.2.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 675c5d96ced90c435068fbcf3410fd9263584a09d42e131c9ef4245640d53ca0 |
|
MD5 | c82d5a1bf5180e96d659eaf3329950c8 |
|
BLAKE2b-256 | aa93d7c7380017a92721849d935887dacec7bb49f283b7da36addf003972df4a |
File details
Details for the file django_inlinecss_redux-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: django_inlinecss_redux-0.1.2-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45466391070eda94733c87c574432d2ca4e6c9bd7b23d66528d2d5620203f525 |
|
MD5 | 671be7de763c1725c1f490bda61b70bc |
|
BLAKE2b-256 | 3aebf3004314abd7bf92fb4b27ba7b28b25a936e99b52d4fd831052526041c77 |