peterbe / premailer

Turns CSS blocks into style attributes
https://premailer.io
BSD 3-Clause "New" or "Revised" License
1.06k stars 188 forks source link

Reusing premailer instances does not work #217

Closed viernullvier closed 5 years ago

viernullvier commented 5 years ago

The README contains a nice section on speeding up premailer by reusing premailer instances. This, however, throws an exception on subsequent iterations because the instance's internal html attribute was already set on the first iteration.

Possible solutions: a) Refactor code to allow for multiple runs b) Remove problematic section from documentation

peterbe commented 5 years ago

Wow! That's a good catch. Would you mind attacking point a) so we can "fail forward"?

viernullvier commented 5 years ago

I've just had a look at the code. As far as I can see, there was no specific reason to rely on self.html so I've refactored transform() to just use its own html argument (and fall back to self.html in case it's not given).

peterbe commented 5 years ago

For the record, @shanon-equityzen and I are discussing the release process here: https://github.com/peterbe/premailer/pull/218#issuecomment-471543169