emails: Inline CSS in emails in build_email.

Previously, we had an architecture where CSS inlining for emails was
done at provision time in inline_email_css.py. This was necessary
because the library we were using for this, Premailer, was extremely
slow, and doing the inlining for every outgoing email would have been
prohibitively expensive.

Now that we've migrated to a more modern library that inlines the
small amount of CSS we have into emails nearly instantly, we are able
to remove the complex architecture built to work around Premailer
being slow and just do the CSS inlining as the final step in sending
each individual email.

This has several significant benefits:

* Removes a fiddly provisioning step that made the edit/refresh cycle
  for modifying email templates confusing; there's no longer a CSS
  inlining step that, if you forget to do it, results in your testing a
  stale variant of the email templates.
* Fixes internationalization problems related to translators working
  with pre-CSS-inlined emails, and then Django trying to apply the
  translators to the post-CSS-inlined version.
* Makes the send_custom_email pipeline simpler and easier to improve.

Signed-off-by: Daniil Fadeev <fadeevd@zulip.com>
This commit is contained in:
Daniil Fadeev
2023-04-05 13:19:58 +04:00
committed by Tim Abbott
parent 7202a98438
commit 2f203f4de1
33 changed files with 91 additions and 214 deletions

View File

@@ -33,9 +33,6 @@ setup_node_modules(production=True)
# Build emoji
run(["./tools/setup/emoji/build_emoji"])
# Inline CSS in emails
run(["./scripts/setup/inline_email_css.py"])
# Copy over static files from the zulip_bots package
run(["./tools/setup/generate_zulip_bots_static_files.py"])