It sounds like your issue is with the syntax of Jinja, and the hellscape of HTML email. I'm not sure how 20 MB of inscrutable JavaScript would help, considering it's also just template rendering with extra steps (bonus: using the user's CPU cycles and power instead of your own).