posthtml-inline-css icon indicating copy to clipboard operation
posthtml-inline-css copied to clipboard

Remove unnecessary CSS and class names

Open stevenvachon opened this issue 8 years ago • 2 comments

Before:

<head>
<style>
body{color:silver}
.class1{color:red}
.class1:hover{color:blue !important}
.class2{color:purple}
</style>
</head>

<body>
<a class="class1"></a>
<a class="class2"></a>
</body>

After:

<head>
<style>
.class1:hover{color:blue !important}
</style>
</head>

<body style="color:silver">
<a class="class1" style="color:red"></a>
<a style="color:purple"></a>
</body>

styliner does this, and juice sort of does.

stevenvachon avatar Dec 01 '16 18:12 stevenvachon

posthtml-email-remove-unused-css may help with this.

stevenvachon avatar Apr 05 '17 19:04 stevenvachon

I've started working on it from scratch, borrowing ideas from posthtml-inline-css - see here:

https://github.com/cossssmin/posthtml-postcss-inline

Regarding this:

posthtml-email-remove-unused-css may help with this.

It's no longer available and its successor, email-comb, doesn't work that way - it needs to see the selector missing from one place to remove it from the other.

What I've done is to introduce an option that will remove each successfully-inlined selector - currently works for the <style> tag, but will try to expand it to the corresponding HTML elements.

If anyone wants to help work on this just let me know, I'd also be happy to merge it back here so we don't publish multiple plugins that solve the same problem 👍

cossssmin avatar Nov 30 '23 21:11 cossssmin