From facfdcf97dbd13352e01c1dbee8e2825e4f9083e Mon Sep 17 00:00:00 2001 From: Philip Wagner Date: Wed, 26 Mar 2025 13:23:40 +0100 Subject: [PATCH] add cache buster --- site/plugins/my-helper/index.php | 11 ++++++++++- site/snippets/header.php | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/site/plugins/my-helper/index.php b/site/plugins/my-helper/index.php index c82d478..8ac53c6 100644 --- a/site/plugins/my-helper/index.php +++ b/site/plugins/my-helper/index.php @@ -31,4 +31,13 @@ function randomBg(): string { static $colors = ["#f1edeb", "#ff00ff", "#48bd8d", "#8200ff", "#ff6700"]; $a = array_rand($colors, 2); return bg($colors[$a[0]], $colors[$a[1]]); -} \ No newline at end of file +} + +Kirby::plugin('cache/buster', [ + 'components' => [ + 'css' => function ($kirby, $url, $options) { + $hash = md5_file($url); + return "$url?$hash"; + } + ] +]); \ No newline at end of file diff --git a/site/snippets/header.php b/site/snippets/header.php index c429b38..435e0f7 100644 --- a/site/snippets/header.php +++ b/site/snippets/header.php @@ -8,7 +8,7 @@ @font-face { font-family: 'Kobata'; src: url('') format('woff2') } @font-face { font-family: 'VG5000'; src: url('') format('woff2') } - +