This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

inlinestyler is an easy way to locally inline CSS into an HTML email message.

Styling HTML email is a black art. CSS works, but only when it’s been placed inline on the individual elements (and event then, not always) - which makes development frustrating, and iteration slow.

The general solution is to use an inlining service, which takes a message with the CSS placed externally, and rewrites it so that all CSS is applied to the individual elements. The most widely used of these services - and as far as I can tell, the one that powers CampaignMonitor - is Premailer. It’s a great service, and the guys behind it put a lot of work into keeping it up to date with the most recent discoveries in what works and what doesn’t.

inlinestyler takes (most) of the functionality of Premailer, and makes it available locally, accessible without having call a remote service.

To see what inline-styler can do, check out this demo.

History

Dave Cranwell wrote the original inline-styler single-app Django project, and (graciously) released it. inlinestyler is a refactor of that project into a free-standing package usable outside of Django.

Requirements

inlinestyler requires the following packages in order to run:

  • cssutils
  • lxml

It also requires a css_complaiance.csv file, which indicates the compatibility of various email clients with certain CSS features. This is included with the package, but can be updated manually from Campaign Monitor’s spreadsheet.

Usage

from inlinestyler.utils import inline_css
message_inline_css = inline_css(message_external_css)

message_external_css must be a string containing the message to be inlined, with the CSS presented in the HTML as one of:

  • an absolute link <link rel="stylesheet" href="http://mysite.com/styles.css" />
  • a <style> block in the <head>, without the use of @import.

The code will also calculate an estimate for how compatible your message is with various clients (using the css_compliance.csv file), but this number isn’t yet exposed.

Contributions

All development happens at github: http://github.com/dlanger/inlinestyler.

To get yourself started:

  1. Clone this repo somewhere
  2. make init to install the right dependencies
  3. make test to run the test suite

Contributions are always more than welcome. If you see something missing, add it in and send me a pull request.

NOTE: Ubuntu 12.04 (and some other distros) include libxslt version 1.1.26, which changes the now-empty <head> tag to <head/> - which isn’t valid HTML 5. To see which version of libxslt was used to build your libxml, examine the output of make init and look for the line that looks like Using build configuration of libxslt 1.1.XX; if that says 26, some test failures are expected (at which point, you can rely on TravisCI to run your tests for you).

You could also install your own version of libxslt from source, but you’re probably going to have a bad time.

License

This distribution is licensed under the New BSD License. Please see the LICENSE file for a full copy of the license text.

As far as I can tell, Dave Cranwell released the underlying inline-styler project into the public domain:

I’m […] releasing it to the public after many requests for the source.
Release History

Release History

0.2.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.7

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
inlinestyler-0.2.3-py2-none-any.whl (16.7 kB) Copy SHA256 Checksum SHA256 py2 Wheel Nov 2, 2015
inlinestyler-0.2.3.tar.gz (16.1 kB) Copy SHA256 Checksum SHA256 Source Nov 2, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting