Fix: Cache-Busting für statische Assets via Git-Commit-Hash
This commit is contained in:
parent
00fc2e4a26
commit
7022e50b3b
5 changed files with 13 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -6,3 +6,4 @@ backups/
|
|||
*.log
|
||||
.claude/
|
||||
*.csv
|
||||
public/static/.asset-version
|
||||
|
|
|
|||
|
|
@ -6,6 +6,11 @@ define('BASE_DIR', dirname(__DIR__));
|
|||
|
||||
require BASE_DIR . '/vendor/autoload.php';
|
||||
|
||||
// Cache-Buster für statische Assets: Git-Commit-Hash aus Datei lesen
|
||||
$_assetVersionFile = BASE_DIR . '/public/static/.asset-version';
|
||||
define('ASSET_VERSION', file_exists($_assetVersionFile) ? trim(file_get_contents($_assetVersionFile)) : 'dev');
|
||||
unset($_assetVersionFile);
|
||||
|
||||
use Steuerkram\Auth;
|
||||
use Steuerkram\Config;
|
||||
use Steuerkram\Router;
|
||||
|
|
|
|||
|
|
@ -161,6 +161,10 @@ else
|
|||
for f in "${CHANGED_FILES[@]}"; do info " $f"; done
|
||||
fi
|
||||
|
||||
# Asset-Version aktualisieren (Cache-Buster für CSS/JS)
|
||||
git rev-parse --short HEAD > "$PROJECT_DIR/public/static/.asset-version"
|
||||
ok "Asset-Version gesetzt: $(cat "$PROJECT_DIR/public/static/.asset-version")"
|
||||
|
||||
# ── Rebuild-Bedarf ermitteln ─────────────────────────────────────────────────
|
||||
NEEDS_REBUILD=false
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?= \Steuerkram\View::h($pageTitle ?? 'Steuerkram') ?> – Steuerkram</title>
|
||||
<link rel="stylesheet" href="/static/css/app.css">
|
||||
<link rel="stylesheet" href="/static/css/app.css?v=<?= defined('ASSET_VERSION') ? ASSET_VERSION : 'dev' ?>">
|
||||
<link rel="icon" type="image/png" href="/static/favicon/favicon-96x96.png" sizes="96x96" />
|
||||
<link rel="icon" type="image/svg+xml" href="/static/favicon/favicon.svg" />
|
||||
<link rel="shortcut icon" href="/static/favicon/favicon.ico" />
|
||||
|
|
@ -47,6 +47,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/static/js/app.js"></script>
|
||||
<script src="/static/js/app.js?v=<?= defined('ASSET_VERSION') ? ASSET_VERSION : 'dev' ?>"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Anmelden – Steuerkram</title>
|
||||
<link rel="stylesheet" href="/static/css/app.css">
|
||||
<link rel="stylesheet" href="/static/css/app.css?v=<?= defined('ASSET_VERSION') ? ASSET_VERSION : 'dev' ?>">
|
||||
<link rel="icon" type="image/png" href="/static/favicon/favicon-96x96.png" sizes="96x96">
|
||||
<link rel="icon" type="image/svg+xml" href="/static/favicon/favicon.svg">
|
||||
<link rel="shortcut icon" href="/static/favicon/favicon.ico">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue