Improved CSS and JS version management
At the very least we need to set the versions of external CSS and JS dependencies in one place. One example is Leaflet, which currently gets loaded individually for the following templates: dashboard.html, asset.html and asset_new.html. This makes version management more cumbersome than it should be. I suggest moving the version requirements into the app, and using Jinja to inject the right scripts in the right place within our templates. This would be similar to how bokeh handles this already:
In the view:
bokeh_html_embedded = ""
for css in CDN.css_files:
bokeh_html_embedded += (
"""<link href="%s" rel="stylesheet" type="text/css">\n""" % css
)
for js in CDN.js_files:
bokeh_html_embedded += """<script src="%s"></script>\n""" % js
In the html:
{{ bokeh_html_embedded | safe }}
Commit https://github.com/SeitaBV/flexmeasures/pull/99/commits/fdcd2f704278a1ddf4749d2af3ac5f794a56ddd6 in PR #99 introduced an idea to handle JS version management.