Giving back to the open source community
Emma gives open source some style
Emma has a strong history of giving back to charity, donating volunteer time, money and loads of moral support to causes local, national, international and environmental. Within our development team, though, giving back often takes a slightly different form. Nearly every piece of our application infrastructure is deeply dependent on open source projects like Python, Django, PostgreSQL and countless others. That said, we’d be poor citizens of the open source community if we weren’t giving back in developer time.
Furthermore, Emma has always put a strong emphasis on making good design simple to use. Anything we can do to make the lives of email designers easier — both inside and outside the company — is a win for us and our customers.
For these reasons, we Emma developers have been contributing bug fixes and improvements to two open source projects that we are using to make email design easier.
InlineStyler
Given that email clients are notoriously bad at respecting CSS rules in <style>
tags, inline style
attributes are the painful solution HTML email designers are left with. Sadly, this renders concise and reusable CSS rules useless. Classes and IDs, which any front-end web developer couldn’t live without, are unusable in email.
InlineStyler is a Python library that helps email designers circumvent this restriction. Very much like the Ruby-based Premailer tool, InlineStyler compiles all CSS rules in <style>
tags in a block of HTML and applies them to all the appropriate HTML elements as style
attributes. For the end user, everything looks styled as expected. Meanwhile the designer is able to take full advantage of the wide variety of CSS selectors available.
In conjunction with the new email editor we’re working on, we run InlineStyler on HTML email content at the last minute on the server before queuing up a mailing. This means email designers won’t ever have to think about inline style
attributes ever again.
InlineStyler was originally built by a friend and former Emma developer, who open-sourced it and has graciously been managing and merging our pull requests. In recent months, we’ve contributed bug fixes, improvements to reduce the resulting HTML’s size, and general tweaks to make it align with the Python community’s packaging standards.
We plan to continue improving InlineStyler as needed. A couple goals we’d love to reach are providing full, W3C-defined CSS selector support, continued improvements to reduce HTML size, and overall code quality.
soupselect
This segues nicely into the other project to which we’re contributing. soupselect is a Python library, built on the popular HTML scraping library BeautifulSoup. It provides the ability to select elements in a block of HTML using CSS selectors, similar to how jQuery does in JavaScript.
InlineStyler is heavily dependent on this library, so helping get soupselect to a point where it supports the full range of W3C-defined CSS selectors directly contribute to our hopes for InlineStyler.
That said, in recent weeks Simon Willison, the creator of soupselect (and co-founder of Lanyrd, coincidentally), has accepted and merged an improvement we wrote to add support for the CSS >
selector.
These changes may seem minor, but we’re excited about the potential both projects have, and are thankful that their original authors are considering and including our contributions. Not only does it feel good to make code contributions that are useful to others, but it’s exciting to tell Emma’s email design team that, in the near future, email design skills could be interchangeable with those needed to build any kind of web content.