An open API service indexing awesome lists of open source software.

https://github.com/lyst/django-inlinify


https://github.com/lyst/django-inlinify

Last synced: about 1 year ago
JSON representation

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