Hash custom.css version

This commit is contained in:
Otto Winter 2019-03-05 20:33:51 +01:00
parent 0991fb0e06
commit a8074ab7f6
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E
2 changed files with 8 additions and 1 deletions

View File

@ -5,7 +5,7 @@
{% endblock %}
{%- block extrahead %}
<link rel="stylesheet" href="{{ pathto('_static/custom.css', 1) }}" type="text/css" />
<link rel="stylesheet" href="{{ pathto('_static/custom.css', 1) }}?hash={{ custom_css_hash }}" type="text/css" />
<link rel="apple-touch-icon" sizes="180x180" href="/_static/apple-touch-icon.png">
<link rel="shortcut icon" href="/_static/favicon.ico">
<link rel="icon" type="image/png" sizes="512x512" href="/_static/favicon-512x512.png">

View File

@ -113,6 +113,9 @@ html_theme = 'alabaster'
# documentation.
#
html_baseurl = os.getenv('BASE_URL', 'https://esphome.io')
with open('_static/custom.css', 'rb') as f:
custom_css_hash = "{:08X}".format(hash(f.read()) % 2**32)
html_theme_options = {
# 'logo': 'logo-full.png',
'logo_name': False,
@ -122,6 +125,10 @@ html_theme_options = {
'show_powered_by': False,
}
html_context = {
'custom_css_hash': custom_css_hash,
}
html_logo = 'images/logo-text.svg'
html_copy_source = True
html_show_sourcelink = False