Skip to content

dev: Adopt mjml 5 for email template generation#7979

Merged
nicholaspcr merged 1 commit into
v3.36from
dev/mjml-5
Jul 22, 2026
Merged

dev: Adopt mjml 5 for email template generation#7979
nicholaspcr merged 1 commit into
v3.36from
dev/mjml-5

Conversation

@nicholaspcr

Copy link
Copy Markdown
Contributor

Alternative to #7978. That PR reverts mjml to 4.18.0 to unblock CI immediately; this PR instead adopts MJML v5. Pick one — merging this makes the revert unnecessary.

Summary

MJML v5 disabled mj-include by default for security, which is what broke the generated-template CI check: generate.sh didn't pass --config.allowIncludes true, so the _attributes/_header/_footer partials were dropped and base.html.tmpl regenerated with MJML's default Ubuntu config.

This PR keeps the v5 bump and makes generation v5-compatible instead of reverting it.

Changes

  • generate.sh: pass --config.allowIncludes true; append the trailing newline v5 no longer emits
  • base.html.tmpl: regenerated under v5 — functionally identical to v4 (6 blank lines removed inside <style> blocks + one attribute-order change on the article <div>; header/footer/body/fonts/styles all unchanged)
  • testdata/*.body.golden.html (13 files): regenerated via go test -write-golden to reflect the base-template change
  • DEVELOPMENT.md: document why includes are enabled
  • No package.json/yarn.lock changes — v3.36 already pins mjml@^5.4.0

Test plan

  • go generate ./pkg/email/templates reproduces base.html.tmpl with no diff
  • go test ./pkg/email/templates passes (golden-file comparison)
  • CI generated-file check passes

Notes for reviewers

The rendered HTML is equivalent to v4 — no email-client-visible change is expected. allowIncludes is safe here because the included .mjml files are trusted and committed to this repo.

MJML v5 disabled mj-include by default. Enable includes in generate.sh
(--config.allowIncludes true) so the base template's trusted repo-local
partials resolve, and append a trailing newline that v5 no longer emits.
Regenerate base.html.tmpl and the golden files; the output is
functionally identical to v4 (whitespace and one attribute-order change
only).
@nicholaspcr
nicholaspcr marked this pull request as ready for review July 22, 2026 16:20
@nicholaspcr
nicholaspcr requested a review from a team as a code owner July 22, 2026 16:20
@nicholaspcr
nicholaspcr requested a review from halimi July 22, 2026 16:20
@nicholaspcr
nicholaspcr merged commit 94c829e into v3.36 Jul 22, 2026
13 checks passed
@nicholaspcr
nicholaspcr deleted the dev/mjml-5 branch July 22, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant