Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to apply Premailer #90

Closed
wants to merge 1 commit into from
Closed

Document how to apply Premailer #90

wants to merge 1 commit into from

Conversation

vfaronov
Copy link

@vfaronov vfaronov commented Jul 7, 2017

Did I get it right?

Did I get it right?
@coveralls
Copy link

coveralls commented Jul 7, 2017

Coverage Status

Coverage remained the same at 92.139% when pulling 70b4ef0 on vfaronov:patch-1 into 6075e14 on lavr:master.

>>> html = '''<style>h1 { color: red }</style>
... <h1>Hello world!</h1>'''
>>> message = emails.Message(html=html)
>>> message.transformer.premailer.transform()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Premailer is a great library, but using it's abstractions here looks a little confusing for me.

Supposed way to do basic transformations is Transformer.load_and_transform:

message = emails.Message(html='''<style>h1 { color: red }</style>
         <h1>Hello world!</h1>''')
message.transformer.load_and_transform()
message.transformer.save()
print(message.html)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think that this example and the previous one (about images inlining) should be replaced with one bigger example that explains the arguments to load_and_transform?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. I don't like this code now. I think should add message.transform method that incapsulates load_and_transform & save

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me. Well then, I’ll withdraw this PR for now.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#92

@vfaronov vfaronov closed this Jul 7, 2017
@lavr lavr mentioned this pull request Jul 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants