https://github.com/lyst/django-inlinify
https://github.com/lyst/django-inlinify
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/lyst/django-inlinify
- Owner: lyst
- License: apache-2.0
- Created: 2014-10-22T18:41:18.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2016-01-04T12:59:38.000Z (over 10 years ago)
- Last Synced: 2024-10-13T19:07:24.155Z (over 1 year ago)
- Language: Python
- Size: 672 KB
- Stars: 4
- Watchers: 25
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
django-inlinify
=========
Django app for in-lining CSS. This project was initially based on [premailer](https://github.com/peterbe/premailer).
Usage
--------------
Just include `django_inlinify` in your `INSTALLED_APPS` and
```python
from django_inlinify.inlinify import Inlinify
html = '
Title
p * { color: blue }
Title
Text1
Text2
'
p = Inlinify()
p.transform(html)
```
Settings
--------------
Override the following in your Django settings according to your needs. You can check their default values on `django_inlinify/defaults.py`
```python
# the default cache backend. Make sure it exists in `CACHES`
DJANGO_INLINIFY_DEFAULT_CACHE_BACKEND_NAME
# CSS parser cache key prefix
DJANGO_INLINIFY_CSSPARSER_CACHE_KEY_PREFIX
# CSS parser cache key TTL
DJANGO_INLINIFY_CSSPARSER_CACHE_KEY_TTL
# CSS attribute to HTML attribute mapping
DJANGO_INLINIFY_CSS_HTML_ATTRIBUTE_MAPPING
# CSS loader cache key prefix
DJANGO_INLINIFY_CSSLOADER_CACHE_KEY_PREFIX
# CSS loader cache key TTL
DJANGO_INLINIFY_CSSLOADER_CACHE_KEY_TTL
```
Running tests
----
The best way to run tests is to do it using `tox` so they run in different environments, ensuring compatiblity with
different python versions
```python
# install tox if you haven't already
pip install tox
# run it
tox
```
Version
----
0.0.16