Skip to content

feat: inline duplicate properties#575

Merged
cossssmin merged 1 commit into
masterfrom
inline-duplicates
Oct 29, 2025
Merged

feat: inline duplicate properties#575
cossssmin merged 1 commit into
masterfrom
inline-duplicates

Conversation

@cossssmin

@cossssmin cossssmin commented Oct 29, 2025

Copy link
Copy Markdown
Collaborator

This PR introduces a new option, inlineDuplicateProperties, which allows the user to choose whether Juice should inline the same property multiple times on the same element, instead of only inlining the winning/highest specificity selector.

This option is false by default, you need to opt-in to the functionality.

The use-case is particularly for HTML emails, where progressive enhancement is sometimes required because not all email clients support the same level of CSS features. For example, given this Tailwind CSS example:

<div class="bg-black bg-black/50" />

... with inlineDuplicateProperties: true we can get this output:

<div style="background-color: #000; background-color: rgba(0,0,0,0.5)" />

... which will show a solid black background color in clients such as Outlook on Windows, which do not support rgba.


Closes #380

@cossssmin

Copy link
Copy Markdown
Collaborator Author

@jrit not sure if you want to review?

@jrit

jrit commented Oct 29, 2025

Copy link
Copy Markdown
Collaborator

no qualms from me, I defer to your decisions @cossssmin

@cossssmin cossssmin merged commit b2abdc2 into master Oct 29, 2025
3 checks passed
@cossssmin

cossssmin commented Oct 29, 2025

Copy link
Copy Markdown
Collaborator Author

Thanks man, I have one more idea for a feature and I also want to look into #387, then we can do a feature release. And after that I can look into the cheerio/undici thing, to update that dependency too and do a major release (since cheerio now needs Node 18).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inline the same property multiple times

2 participants