css versioniert

This commit is contained in:
hubobel 2026-06-25 16:47:18 +02:00
parent d1c84d0ea9
commit fa1eccb805
2 changed files with 18 additions and 2 deletions

18
app.py
View file

@ -14,6 +14,7 @@ import shutil
from shutil import copy2 from shutil import copy2
import logging import logging
import platform import platform
import os
# -------------------------------------------------- # --------------------------------------------------
# Logging # Logging
# -------------------------------------------------- # --------------------------------------------------
@ -407,9 +408,23 @@ def get_balance_comparison():
result_data[names[idx]] = data result_data[names[idx]] = data
return result_data return result_data
@app.context_processor
def inject_css_version():
return {
"css_version": int(
os.path.getmtime(
BASE_DIR / "static" / "style.css"
)
)
}
@app.route("/") @app.route("/")
def index(): def index():
css_version = int(
os.path.getmtime(
BASE_DIR / "static" / "style.css"
)
)
( (
year, year,
week, week,
@ -446,6 +461,7 @@ def index():
total_expenses=total_expenses, total_expenses=total_expenses,
total_saldo=total_saldo, total_saldo=total_saldo,
balance=balance, balance=balance,
css_version=css_version,
balance_color=balance_color, balance_color=balance_color,
current_day=current_day, current_day=current_day,
balance_history=balance_history balance_history=balance_history

View file

@ -12,7 +12,7 @@
</title> </title>
<link rel="stylesheet" <link rel="stylesheet"
href="{{ url_for('static', filename='style.css') }}"> href="{{ url_for('static', filename='style.css') }}?v={{ css_version }}">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>