peterbe/premailer — pull request #87 by jonbretman (2014-10-17 00:34:40+00:00)
Title: Add css_text option to allow css strings to be provided

This adds a new option to Premailer - `css_text` - which allows you to pass some css in directly that should be applied to the given html.

This is very useful if you are sending thousands of emails, each one with personalised content, but that all use the same CSS file. The css file(s) can then be read once and cached and passed directly to Premailer each time, avoiding any additional disc/network IO.

**Before**
```python
for recipient in recipients:
html = render_html(recipient)
# will read from disc every time
html = Premailer(html, external_style='style.css').transform()
send_email(html)
```

**After**
```python
# read from disc once
css = read_file('style.css')
for recipient in recipients:
html = render_html(recipient)
# no disc IO needed
html = Premailer(html, css_text=css).transform()
send_email(html)
```

Additionally fixed some pep8/flake8 warnings.