Rollup plugin to compile MJML templates into HTML during the build process. Current version 1.0.3, released in 2020. The plugin works by importing .mjml files in JavaScript or using @rollup/plugin-multi-entry to bundle templates. It outputs HTML files to a specified directory, with options for validation level and output extension. This plugin bridges the gap between Rollup bundling and MJML email template compilation, allowing integration into modern build pipelines. Longer release cadence; last update over 2 years ago.
npm install rollup-plugin-mjmlVerified import paths — ran on the pinned version, not inferred.
Shows basic Rollup configuration with rollup-plugin-mjml, importing an MJML file and outputting HTML to a subdirectory.
Ensure your .mjml files are imported (e.g., import './template.mjml') or use @rollup/plugin-multi-entry to include them as entry points.
Set outputDir relative to project root, e.g., 'dist/email'.
Test with your specific versions of Rollup and MJML. Consider using alternative plugins or manual integration.
Set validationLevel: 'strict' to ensure errors are surfaced during build.
Run npm install rollup-plugin-mjml --save-dev
Use const mjml = require('rollup-plugin-mjml').default;Add mjml() to plugins array in rollup.config.js.