emogrifier icon indicating copy to clipboard operation
emogrifier copied to clipboard

Support to convert CSS Variables?

Open njt1982 opened this issue 6 months ago • 4 comments

Hi,

Is it already possible to convert CSS variables into inline values?

For example...

  • The HTML email being sent needs per-site brand colours used (eg button background).
  • Have the button with a bg-brand class on it.
  • I have some CSS text being dynamically generated
  • The CSS currently contains something like:
body {
  --brand: #ff0000;
}
.bg-brand {
  background: var(--brand);
}
.link-color {
  color: var(--brand);
}
td.container {
  border-color: var(--brand);
}

(this is a simplified example!).

For now, I'm going to change my code to replace var(--brand) with something like [BRAND-COLOR] and then string replace that with the hex code...

I'm only asking as I already have CSS elsewhere that defines these brand colour variables and it would be nice to reuse that rather than repeat the same variables in different languages in different places :)

(PS Thank for all the work on this package!)

njt1982 avatar Aug 08 '24 09:08 njt1982