Liquid and MJML Email Templates
Transactional emails are the last HTML Spree renders through Rails views. This plan replaces all 61 ActionMailer ERB templates (16 mailers across spree_core and spree_emails) with Liquid templates written in MJML. Liquid fills in the data first, then MJML turns the result into email-safe HTML, using the mrml gem (no Node). Templates read plain JSON from email serializers, never models.
This makes the templates portable (Liquid also runs in Node through liquidjs), safe to hand to merchants later, and much shorter than today's hand-written HTML tables. Merchant editing in the dashboard, database-stored templates and live previews come later on this foundation. Action Mailer still delivers every email.
Status: design finalized, nothing built.
Migration path
- Move Alba into
spree_core, together with its setup. - Build the renderer and resolver in
spree_core:liquidandmrml, the lookup chain with a deprecated ERB step, HTML escaping by default, render limits, filters, and plain-text generation. - Rebuild the layout and partials in MJML.
- Migrate the core mailers, then the
spree_emailsmailers, each with its email serializer and a render spec. - Write the docs: the override guide, a generated variable reference, and the upgrade note.
- In 6.2, remove the ERB fallback.
Plan: https://github.com/spree/spree/blob/main/docs/plans/6.1-liquid-mjml-emails.md
Tracked in Linear as V-3720
Source: spree/spree