-
Notifications
You must be signed in to change notification settings - Fork 7
Migrating to v3
Inline Email v3 modernizes the package around a stable library API, a maintained CLI, and built-in responsive email primitives.
v3 requires Node.js 20 or newer.
The npm package remains:
npm install inline-emailThe CLI command also remains:
inline-email input.html --out output.htmlv2 exposed the internal renderer through lib/render. v3 exposes stable package entry points instead.
const render = require('inline-email/lib/render');
const html = await render(sourceHtml, sourceCss, options);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);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}}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)
});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.
The CLI remains available:
inline-email input.html
inline-email input.html --out output.html
inline-email --css style.css input.htmlThe legacy --inky flag was removed. Use the built-in responsive primitives or a compile-stage transform.
Inline Email is maintained by Freethinking IT.