Skip to content

Migrating to v3

Dan Sabin edited this page Jun 8, 2026 · 1 revision

Migrating to Inline Email v3

Inline Email v3 modernizes the package around a stable library API, a maintained CLI, and built-in responsive email primitives.

Requirements

v3 requires Node.js 20 or newer.

Package Name

The npm package remains:

npm install inline-email

The CLI command also remains:

inline-email input.html --out output.html

Library API

v2 exposed the internal renderer through lib/render. v3 exposes stable package entry points instead.

v2

const render = require('inline-email/lib/render');

const html = await render(sourceHtml, sourceCss, options);

v3

const { compileEmailTemplate, renderEmail, inlineEmailHtml } = require('inline-email');

Compile templates once, then render dynamic data when sending:

const compiled = await compileEmailTemplate({
  subject: 'Welcome, {{firstName}}',
  html,
  css,
  text: 'Welcome, {{firstName}}'
});

const email = compiled.render({
  data: {
    firstName: 'Dan',
    appUrl: 'https://app.example.com'
  }
});

For raw CSS inlining without runtime template rendering:

const html = await inlineEmailHtml(sourceHtml, sourceCss);

Template Syntax

Variables are escaped by default:

<p>Hello {{firstName}}</p>

Repeated blocks render arrays:

{{#items}}
<p>{{label}}</p>
{{/items}}

Trusted HTML must use explicit slots:

{{slot:summary}}

Inky

v2 optionally preprocessed Inky with --inky. v3 does not depend on Inky.

Use the built-in responsive primitives, preprocess Inky before passing HTML into Inline Email, or plug in a project-specific compile step:

const compiled = await compileEmailTemplate({
  html,
  css,
  transform: (source) => renderYourLayoutSyntax(source)
});

CSS Inlining

v3 uses a modern Juice pipeline. Normal selectors are inlined and removed from <style> output when possible:

.footer .social-links a {
  margin-left: 10px;
  white-space: nowrap;
}

becomes:

<a style="margin-left: 10px; white-space: nowrap;">...</a>

Responsive media queries are intentionally preserved in <style> tags because email clients need those rules at render time.

CLI Changes

The CLI remains available:

inline-email input.html
inline-email input.html --out output.html
inline-email --css style.css input.html

The legacy --inky flag was removed. Use the built-in responsive primitives or a compile-stage transform.

Clone this wiki locally