Creates HTML emails with maximal CSS compatibility by inlining external CSS files.
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 1 commit ahead of davecranwell:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
static
styler
.gitignore
README.md
__init__.py
css_compliance.csv
manage.py
settings.py
settings_local.py
urls.py
wsgi.py

README.md

Inline Styler makes CSS compatible with email clients.

Try it here: https://inlinestyler.visigo.com

It's a service which, when given a block of HTML including CSS, will parse the CSS and convert it to inline style="" attributes on each elements matched by the CSS rules found.

The benefit of this is primarily in developing HTML emails. The most common email clients have patchy support for <style> or <link> elements, but do on the whole support a varied set of CSS properties. Its therefore necessary to instead define styles in "style" attributes on each of the elements themselves, which is tedious for anything but the simplest of emails and introduces significant code maintenance problems. The Inline Styler frees up the developer to write CSS in less tedious/more maintainable ways: using proper selectors and rules, grouped in either a stylesheet or a <style> block. The Inline Styler converts these rules into the inline "style" attributes for you.

Additionally, among the email clients who do support CSS, support for individual CSS properties is variable. The Inline Styler will analyse your CSS and estimate a compatibility rating across all the email clients as a whole, alerting you to any particular properties likely to reduce compatibility.

Usage

To use this app, CSS you wish to be "inlined" must be declared in the HTML either:

  • linked absolutely e.g <link rel="stylesheet" href="http://mysite.com/styles.css" /> or
  • provided in a <style> block in the <head> of the HTML, without @imports

Self-hosting requirements

This file requires periodic updates as Campaign Monitor update their spreadsheet. Comparing the existing file to CM's spreadsheet, the key differences are that their XLS has been stripped of formatting, blank lines or duplicate groups of selector/element information.

History

Inline Styler was created by @davecranwell and was originally hosted at http://inlinestyler.torchbox.com/. This went offline in Dec 2017, so I have forked this and setup hosting at https://inlinestyler.visigo.com/.

Original github repo is: https://github.com/davecranwell/inline-styler.

Questions/Discussion