Skip to content

Commit 2ee5dd6

Browse files
committed
chore: query param for cache busting css
1 parent 1ca4804 commit 2ee5dd6

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ module github.com/picosh/docs
22

33
go 1.21.5
44

5-
// replace github.com/picosh/pdocs => /home/erock/dev/pico/pdocs
5+
replace github.com/picosh/pdocs => /home/erock/dev/pico/pdocs
66

7-
require github.com/picosh/pdocs v0.0.0-20241118043636-3059918103f6
7+
require github.com/picosh/pdocs v0.0.0-20241118044720-1a43b70d33b7
88

99
require (
1010
github.com/alecthomas/chroma v0.10.0 // indirect

go.sum

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
66
github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
77
github.com/dlclark/regexp2 v1.10.0 h1:+/GIL799phkJqYW+3YbOd8LCcbHzT0Pbo8zl70MHsq0=
88
github.com/dlclark/regexp2 v1.10.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
9-
github.com/picosh/pdocs v0.0.0-20241118043636-3059918103f6 h1:yU+cusov9cu4tcxL1E12GpBibMyxnwIWMRKRFbEffwY=
10-
github.com/picosh/pdocs v0.0.0-20241118043636-3059918103f6/go.mod h1:KXO3Z0EVdA811AX6mlK4lwFDT+KgmegRVrEmZU5uLXU=
119
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1210
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1311
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

main.go

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package main
22

33
import (
44
"log/slog"
5+
"math/rand"
6+
"strconv"
57

68
"github.com/picosh/pdocs"
79
)
@@ -221,6 +223,7 @@ func main() {
221223
Out: "./public",
222224
Tmpl: "./tmpl",
223225
PageTmpl: "post.page.tmpl",
226+
CacheId: strconv.Itoa(rand.Intn(10000)),
224227
}
225228

226229
err := config.GenSite()

tmpl/base.layout.tmpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
<link href="/logo.svg" rel="icon" type="image/svg+xml"/>
1111
<link href="/logo.png" rel="icon" sizes="any" type="image/png"/>
1212

13-
<link rel="stylesheet" href="/syntax.css" />
14-
<link rel="stylesheet" href="/smol.css" />
15-
<link rel="stylesheet" href="/main.css" />
13+
<link rel="stylesheet" href="/syntax.css?v={{.CacheId}}" />
14+
<link rel="stylesheet" href="/smol.css?v={{.CacheId}}" />
15+
<link rel="stylesheet" href="/main.css?v={{.CacheId}}" />
1616
{{template "meta" .}}
1717
</head>
1818

0 commit comments

Comments
 (0)