JSPM

universal-email-templates-cli

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 14
  • Score
    100M100P100Q38846F
  • License MIT

CLI tools for building, translating and exporting professional MJML email templates to Mailchimp, Klaviyo, and HubSpot

Package Exports

  • universal-email-templates-cli
  • universal-email-templates-cli/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (universal-email-templates-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Universal Email Templates CLI

CLI tools for building, translating, and exporting professional MJML email templates.

Features

  • Build MJML templates to HTML
  • Multi-language support (FR, EN, ES, DE, IT, PT, NL, AR)
  • Export to Mailchimp, Klaviyo, and HubSpot formats
  • WCAG 2.1 AAA accessibility compliant
  • Dark mode support

Installation

npm install -g universal-email-templates-cli

Or as a project dependency:

npm install universal-email-templates-cli

CLI Usage

Build Templates

# Build all MJML templates to HTML
email-build --src ./src/templates --dist ./dist/html

# Build with options
email-build --src ./src/templates --dist ./dist/html --minify

Internationalization

# Build all languages
email-i18n --all --src ./src/templates --dist ./dist/i18n

# Build specific language
email-i18n --lang fr --src ./src/templates --dist ./dist/i18n

# Build with themes
email-i18n --lang en --themed --src ./src/templates --dist ./dist/i18n

Export to Platforms

# Export to Mailchimp
email-export --platform mailchimp --src ./dist/html --dist ./dist/mailchimp

# Export to Klaviyo
email-export --platform klaviyo --src ./dist/html --dist ./dist/klaviyo

# Export to HubSpot
email-export --platform hubspot --src ./dist/html --dist ./dist/hubspot

Generate Preview Examples

# Generate examples for all languages
email-examples --dist ./dist --examples ./examples --config ./config/examples

# Generate English only
email-examples en --dist ./dist --examples ./examples --config ./config/examples

# Generate French only
email-examples fr --dist ./dist --examples ./examples --config ./config/examples

# Clean and regenerate
email-examples --clean --dist ./dist --examples ./examples --config ./config/examples

Programmatic Usage

const { build, translate, exportTo } = require('universal-email-templates-cli');

// Build templates
await build({
  src: './src/templates',
  dist: './dist/html',
  minify: true
});

// Translate templates
await translate({
  src: './src/templates',
  dist: './dist/i18n',
  languages: ['fr', 'en', 'es'],
  translations: require('./config/translations')
});

// Export to platform
await exportTo({
  platform: 'mailchimp',
  src: './dist/html',
  dist: './dist/mailchimp'
});

Configuration

Translations

Create a translations.js file:

module.exports = {
  en: {
    greeting_hello: 'Hello',
    btn_get_started: 'Get Started',
    unsubscribe: 'Unsubscribe'
  },
  fr: {
    greeting_hello: 'Bonjour',
    btn_get_started: 'Commencer',
    unsubscribe: 'Se desabonner'
  }
};

Platform Variable Mappings

Our Variable Mailchimp Klaviyo HubSpot
{{first_name}} *|FNAME|* {{ first_name }} {{ contact.firstname }}
{{email}} *|EMAIL|* {{ email }} {{ contact.email }}
{{unsubscribe_url}} *|UNSUB|* {% unsubscribe_url %} {{ unsubscribe_link }}

Supported Languages

Code Language
en English
fr French
es Spanish
de German
it Italian
pt Portuguese
nl Dutch
ar Arabic

License

MIT