Use of Jinga2 doesn't follow best practices
- Dominant language
- JavaScript
- Stars
- 23
- Forks
- 62
- Avg merge
- 24m
- Merged PRs (30d)
- 1
Description
## What is the problem?
The entity emailer is not following best practices when using the templating engine, "Jinga2". Instead of using Jinga2 to extend a base template and replace text blocks, we're doing it backwards by repeating the base template code in every email template and pulling in boilerplate code using a custom script.
## What is the impact?
This atypical use of Jinga2 makes it more difficult to troubleshoot issues and onboard new team members. The custom code is undocumented which delays the period of time that new team members take to get up-to-speed. In addition, changes to the base template (for example, when we switch to sending text messages instead of emails) require greater effort.
## Proposed solution
Use Jinga2 the way it was designed.
### Very simple base template - saved as "base.html"
```html
{% block title %}{% endblock %} - My Webpage
{% block html_head %}{% endblock %}
{% block content %}{% endblock %}
```
### Very simple child template
```html
{% extends "base.html" %}
{% block title %}Index{% endblock %}
{% block html_head %}
.important {
color: #336699;
}
{% endblock %}
{% block content %}
Index
Welcome on my awseome homepage.
{% endblock %}
```
Using this approach, the base template and its boilerplate text is only written once. Child templates extend the base and replace blocks of text that are unique to the specific template.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.