npm Juice Converts CSS in style Tags to Inline Styles - Convenient for HTML Emails

Tadashi Shigeoka ·  Tue, May 1, 2018

I’ll introduce npm Juice, which converts CSS within style tags to inline styles, making it convenient for creating HTML emails.

npm | エヌピーエム

Converting CSS to Inline Styles with npm Juice

When you execute the following JavaScript code:

var juice = require('juice');
var result = juice("
");

The result contains HTML converted to inline styles like this:

Incidentally, while Gmail previously didn’t support style tags, they have been supported since October 2016.

CSS → Inline Style Conversion Site

There’s also an online site that converts style tags to inline styles.

That’s all from the Gemba where I wanted to convert style tags to inline CSS for HTML email creation.