emogrifier icon indicating copy to clipboard operation
emogrifier copied to clipboard

Combine expanded CSS properties to shorthand properties (where possible)

Open zoliszabo opened this issue 7 years ago • 2 comments

Emogrifier may produce inline styles that are redundant.

For example:

<style>
    p {margin: 10px 0}
    p.c {margin-left: 5px; margin-right: 5px}
</style>
<p class="c"></p>

After the above is emogrified, it would look like this:

<p class="c" style="margin: 10px 0; margin-left: 5px; margin-right: 5px"></p>

But it could be simplified like this:

<p class="c" style="margin: 10px 5px"></p>

zoliszabo avatar Jan 10 '18 20:01 zoliszabo

I propose we do this in Emogrifier 4.0.0 by using some library that can shorten CSS. (I don't know whether there is such a library on Packagist, but I'm fairly confident.)

What do you think?

oliverklee avatar Jan 10 '18 20:01 oliverklee

It sounds reasonable to me, there's no hurry with this one.

zoliszabo avatar Jan 10 '18 20:01 zoliszabo