Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/roverdotcom/django-inlinecss
A Django app useful for inlining CSS (primarily for e-mails)
https://github.com/roverdotcom/django-inlinecss
Last synced: about 21 hours ago
JSON representation
A Django app useful for inlining CSS (primarily for e-mails)
- Host: GitHub
- URL: https://github.com/roverdotcom/django-inlinecss
- Owner: roverdotcom
- License: other
- Created: 2012-07-11T07:00:49.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2024-06-06T13:45:13.000Z (7 months ago)
- Last Synced: 2025-01-03T18:06:55.234Z (8 days ago)
- Language: Python
- Size: 93.8 KB
- Stars: 160
- Watchers: 93
- Forks: 94
- Open Issues: 30
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- starred-awesome - django-inlinecss - A Django app useful for inlining CSS (primarily for e-mails) (Python)
README
[![Build Status](https://travis-ci.org/roverdotcom/django-inlinecss.svg?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 3.8+
- Django 3.2+#### 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" %}
Something in need of styling.
{% endinlinecss %}
```#### Step 4: Prepare to be Wowed
```html
Something in need of styling.
```
## 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.