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

Premailer strips important tags from stylesheets meant to be ignored #241

Open chaitanyagupta opened 4 years ago

chaitanyagupta commented 4 years ago

I am using premailer 3.6.1. I noticed that !important is stripped out even from stylesheets that are meant to be ignored:

premailer.transform('<html><head><style data-premailer="ignore">.wrapper { width: 100% !important; }</style><body></body></html>')
'<html><head><style>.wrapper { width: 100%; }</style></head><body></body></html>'

When I set strip_important=False, it is not stripped out as expected. But I don't think this should be required in a stylesheet that premailer is supposed to ignore.

peterbe commented 4 years ago

Makes sense. Do you think you can add a unit test and a fix for it?

chaitanyagupta commented 4 years ago

I will try to do this sometime soon. At the moment, strip_important=False workaround works well enough for me.