level12 / keg

Keg: more than Flask
Other
12 stars 9 forks source link

assets_include works intermittently in imported file #177

Open rsyring opened 3 years ago

rsyring commented 3 years ago

My template landing.html started like:

{% set title = space.name + ' Collaborative' %}
{% import '_resources.html' as res_macros %}
{% extends "collab-base-sidebar.html" %}

I observed that the content from _resources.css only made it into the page immediately after saving landing.html, presumably due to the process/server restart triggered by the file modification. On subsequent browser refreshes, the content was absent.

guruofgentoo commented 2 years ago

The reason this happens is due to Jinja caching imports:

Not sure there's a clean way around this without coming up with a way to change how Jinja caches the import, or using a different approach to assets inclusion altogether.