use tailwind bundle url with ?t compile-time variable.

This commit is contained in:
fiatjaf
2024-01-10 14:29:49 -03:00
parent 8403f6e129
commit bfe302ec8b
2 changed files with 4 additions and 4 deletions

View File

@@ -1,5 +1,7 @@
package main
var compileTimeTs string
templ headCommonTemplate(params HeadParams) {
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
if params.Oembed != "" {
@@ -19,7 +21,7 @@ templ headCommonTemplate(params HeadParams) {
if tailwindDebugStuff != "" {
@templ.Raw(tailwindDebugStuff)
} else {
<link rel="stylesheet" type="text/css" href="/njump/static/tailwind-bundle.min.css"/>
<link rel="stylesheet" type="text/css" href={ "/njump/static/tailwind-bundle.min.css?t=" + compileTimeTs }/>
}
<style> @media print { @page { margin: 2cm 3cm; } } </style>
<meta name="theme-color" content="#e42a6d"/>

View File

@@ -7,9 +7,7 @@ build: templ tailwind
go build -o ./njump
deploy: templ tailwind
sed -i.bak "s#/tailwind-bundle.min.css#/tailwind-bundle.min.css?$(date +'%Y%m%d%H%M')#g" templates/head_common.html
GOOS=linux GOARCH=amd64 go build -o ./njump
mv -f templates/head_common.html.bak templates/head_common.html
GOOS=linux GOARCH=amd64 go build -ldflags="-X main.compileTimeTs=$(date '+%s')" -o ./njump
rsync --progress njump njump:njump/njump-new
ssh njump 'systemctl stop njump'
ssh njump 'mv njump/njump-new njump/njump'