Return a Jinja environment for the theme.
(self)
| 156 | self.__vars.update(theme_config) |
| 157 | |
| 158 | def get_env(self) -> jinja2.Environment: |
| 159 | """Return a Jinja environment for the theme.""" |
| 160 | loader = jinja2.FileSystemLoader(self.dirs) |
| 161 | # No autoreload because editing a template in the middle of a build is not useful. |
| 162 | env = jinja2.Environment(loader=loader, auto_reload=False) |
| 163 | env.filters['url'] = templates.url_filter |
| 164 | env.filters['script_tag'] = templates.script_tag_filter |
| 165 | localization.install_translations(env, self.locale, self.dirs) |
| 166 | return env |
no outgoing calls