dlanger / inlinestyler

A simple CSS inliner for generating HTML email messages.
http://pypi.python.org/pypi/inlinestyler
BSD 3-Clause "New" or "Revised" License
114 stars 23 forks source link

Crashes when bootstrap 3 css is included. #23

Open joecascio opened 8 years ago

joecascio commented 8 years ago

This code crashes with a NotImplemented exception.

from inlinestyler.utils import inline_css

html = """"

<!doctype html>
<html lang="en">
<head>

    <title>Charter 00144</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css"/>
</head>"""

print inline_css(html)
dlanger commented 8 years ago

@joecascio Was there a traceback or anything with the crashing?

joecascio commented 8 years ago

Yes. See question on stackoverflow: http://stackoverflow.com/questions/34817557/python-inlinestyler-fails-on-bootstrap-3-css

On Fri, Jan 15, 2016 at 1:56 PM Daniel Langer notifications@github.com wrote:

@joecascio https://github.com/joecascio Was there a traceback or anything with it

— Reply to this email directly or view it on GitHub https://github.com/dlanger/inlinestyler/issues/23#issuecomment-172053151 .

dlanger commented 8 years ago

Looks like we're hitting cssselect.py with an XPath expression it's not used to/wasn't designed to support. I might try swapping out that whole file with cssselect.

Also, possibly related to https://github.com/dlanger/inlinestyler/issues/10?

dlanger commented 8 years ago

It's also worth pointing out that even when/if we get this working, you're almost certainly Gonna Have A Bad Time trying to email a page you've built out with Bootstrap, unless you're very intentional about how it's built (for example, using tables for layout everywhere) - this SO answer, despite being quite old, is still representative of the state of the art.

I've had pretty good luck using ZURB Foundation as the basis for my high-end design emails - YMMV.

joecascio commented 8 years ago

Thanks for the tip on ZURB! But can you tell me what's the problem with all the web-kit errors?

On Sat, Jan 16, 2016 at 7:26 PM Daniel Langer notifications@github.com wrote:

It's also worth pointing out that even when/if we get this working, you're almost certainly Gonna Have A Bad Time trying to email a page you've built out with Bootstrap, unless you're very intentional about how it's built (for example, using tables for layout everywhere) - this SO answer http://stackoverflow.com/a/10728297, despite being quite old, is still representative of the state of the art.

I've had pretty good luck using ZURB Foundation http://foundation.zurb.com/emails as the basis for my high-end design emails - YMMV.

— Reply to this email directly or view it on GitHub https://github.com/dlanger/inlinestyler/issues/23#issuecomment-172279154 .

dlanger commented 8 years ago

The way this thing works, it only supports the properties listed in css_compliance.csv - and that file hasn't been updated from Campaign Monitor's canonical list in a while.

(That link also explains why CSS3 in emails is such a frustrating experience)