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.0.0.tar.gz
.
File metadata
- Download URL: django-inlinecss-redux-0.0.0.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 120f02b34d6ac8923cb0c4984fa3aafa1693f7d19995271745b6cb77eec832f2 |
|
MD5 | 411e1c5a98605f9328852738f8ad374a |
|
BLAKE2b-256 | 1c3bcae1705d6c77c23b03f56c7cbd3f7d25c85767351a7d325f97c87a60268a |
File details
Details for the file django_inlinecss_redux-0.0.0-py3-none-any.whl
.
File metadata
- Download URL: django_inlinecss_redux-0.0.0-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e77c03807b372a4f4d696a59db9ea29db09ca4d2405d64431f4daedbde74b72 |
|
MD5 | b5c7a85e66e39b823d734cb4c624eda1 |
|
BLAKE2b-256 | f42a2e96343e583ae73f593acaed457b59b00e7024e2b28f6bbecf5ed55b7976 |