Skip to main content

No project description provided

Project description

Django app for in-lining CSS. This project was initially based on premailer.

Usage

Just include django_inlinify in your INSTALLED_APPS and

from django_inlinify.inlinify import Inlinify

html = '<html>
        <head>
        <title>Title</title>
        <style type="text/css">
        p * { color: blue }
        </style>
        </head>
        <body>
        <h1>Title</h1>
        <p><strong>Text1</strong></p>
        <p><strong>Text2</strong></p>
        </body>
        </html>'

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

# 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

DJANGO_SETTINGS_MODULE="django_inlinify.test_settings" python setup.py test

Version

0.0.13

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

django-inlinify-0.0.13.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

django_inlinify-0.0.13-py2-none-any.whl (9.3 kB view details)

Uploaded Python 2

File details

Details for the file django-inlinify-0.0.13.tar.gz.

File metadata

File hashes

Hashes for django-inlinify-0.0.13.tar.gz
Algorithm Hash digest
SHA256 1c2d9100b97d66cff5fc7706ee28d5195007b57a4adf6e94b110d91f2e72ca64
MD5 23a07d716bcd4b933b82ca2da130d262
BLAKE2b-256 1c3c18f9226da5db4aacbd1a161747c2290bc4860da91931126562d790a45029

See more details on using hashes here.

File details

Details for the file django_inlinify-0.0.13-py2-none-any.whl.

File metadata

File hashes

Hashes for django_inlinify-0.0.13-py2-none-any.whl
Algorithm Hash digest
SHA256 20354b67804dcff1b10e8957d46ab281f73b41193f888e9bd8d9ce9f9936ee9c
MD5 b43a33084e4b2abdc1c46ea76b1e1a53
BLAKE2b-256 7d9ea5c977f7c2dd728bf235de0eb112abd8e49616547b7a3ccd3abb33b90c86

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page