From ad5ecbd595e3f7402aaf8604c1a02c227228d38d Mon Sep 17 00:00:00 2001 From: andrzej Date: Fri, 15 Nov 2024 23:40:57 +0100 Subject: [PATCH] edits --- content/posts/cache-busting.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/posts/cache-busting.md b/content/posts/cache-busting.md index 10581a0..bfd77a1 100644 --- a/content/posts/cache-busting.md +++ b/content/posts/cache-busting.md @@ -1,5 +1,5 @@ +++ -date = '2024-11-13T14:24:21+01:00' +date = '2024-11-14T14:24:21+01:00' draft = false title = 'Invalidating the browser cache' tags = ['css','html','linux'] @@ -34,7 +34,7 @@ Of course there is. Look at this: ```html - + ``` As I'm requesting the file via http, I can append a query. Awesome. Not awesome enough though. I'm too lazy to edit this line of code every time I push a commit, and, being human, I'll probably forget at a critical moment. This can only mean one thing: it's time to bash (🤣) out a quick build script. @@ -43,7 +43,7 @@ As I'm requesting the file via http, I can append a query. Awesome. Not awesome ```bash #!/usr/bin/env bash COMMIT="$(git rev-parse HEAD)" -sed -i "s/css?=\w*/css?${COMMIT}/g" index.html +sed -i "s/css?v=\w*/css?${COMMIT}/g" index.html ``` Let's talk about what's happening here: @@ -56,7 +56,7 @@ Now, whenever we push a new commit, any CSS imports in `index.html` will be chan ```html ``` Now I just need to add the build script to my Jenkinsfile...