flexmeasures icon indicating copy to clipboard operation
flexmeasures copied to clipboard

Improved CSS and JS version management

Open Flix6x opened this issue 4 years ago • 1 comments

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 }}

Flix6x avatar Feb 19 '21 11:02 Flix6x

Commit https://github.com/SeitaBV/flexmeasures/pull/99/commits/fdcd2f704278a1ddf4749d2af3ac5f794a56ddd6 in PR #99 introduced an idea to handle JS version management.

Flix6x avatar Apr 20 '21 09:04 Flix6x