The beauty of JavaScript is that there’s an easy-to-use solution for most problems. I use the
inline-css npm module to handle inlining CSS in the above example. I also ran a one-off script using
sharp to convert SVG social media icons into PNGs.
Testing how emails look in different clients is trickier. The gold standard of email testing is
Litmus, which lets you test how your email will render on dozens of different clients. Litmus is powerful, but expensive - it starts at $99/mo, with no free tier.
My alternative approach is to instead write a Mocha test that sends a test checkout email to my Gmail and Outlook accounts. Those are the email services that my clients use, so this ensures the clients are happy, and I figure if the email looks good on 2 common clients (both mobile and desktop), it will probably look fine on most others.