How to add hash strings to custom resources urls in a Bokeh Application?

I am programming a Bokeh Server Application with templates. I have added some custom CSS and JS files. But when I make some changes the files are reloaded from the cache and I cannot see the new changes. One solution is to add a variable at the end of the URL in order to load them from scratch just if there were some changes. Bokeh resources work like that.

I have added the resources as in this example so far

{% extends base %}

<!-- goes in head -->
{% block preamble %}
    <link href="app/static/css/custom.min.css" rel="stylesheet">
    <script type="text/javascript" src="app/static/js/custom.min.js"></script>
{% endblock %}

<!-- goes in body -->
{% block contents %}
    <div> {{ embed(roots.scatter) }} </div>
    <div> {{ embed(roots.line) }} </div>
{% endblock %}

Is there a builtin way to add these hashes? Adding the objects from python would be okay. The result I would like to have is:

<link href="app/static/css/custom.min.css?v=f5ee62ee57a37d94c35e8f7be218e11fc63df459" rel="stylesheet">

This hash string must be added before the page is loaded to make it work well

I found this class, but it seems just for Bokeh resources

When you cross-post, please also include a link to the other question.
I’ve answered it here: python - How to add hash strings to custom resources urls in a Bokeh Application? - Stack Overflow

1 Like

Okay, you are right. Thanks for the answer