You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a problem with certain versions of Outlook email client, and came to a solution where I need to apply styles to every email client, except Microsoft Outlook.
But the problem is that it's being inlined, as it's a valid non-commented <style> attribute.
I've been thinking that having a way to disable inlining of styles from a specific style attribute could solve this. For example, the regular expression in Processor::getCssFromStyleTags() could ignore style tags that have do-not-inline attribute:
Hi!
I'm working on a problem with certain versions of Outlook email client, and came to a solution where I need to apply styles to every email client, except Microsoft Outlook.
There's a conditional comment that can do that:
But the problem is that it's being inlined, as it's a valid non-commented
<style>
attribute.I've been thinking that having a way to disable inlining of styles from a specific style attribute could solve this. For example, the regular expression in
Processor::getCssFromStyleTags()
could ignore style tags that havedo-not-inline
attribute:https://github.com/tijsverkoyen/CssToInlineStyles/blob/master/src/Css/Processor.php#L38-L39
$htmlNoComments = preg_replace('|<!--.*?-->|s', '', $html); + $htmlNoComments = preg_replace('|<style(?:.*\sdo-not-inline\s?.*)?>(.*)</style>|s', '', $htmlNoComments); preg_match_all('|<style(?:\s.*)?>(.*)</style>|isU', $htmlNoComments, $matches);
I can file a PR if you agree it's a good addition.
Anyway, thank you for your great work! This package is helping us a lot with rendering emails 👍
The text was updated successfully, but these errors were encountered: