Skip to content

Commit

Permalink
feat: append suffix to asset path to avoid caching between releases
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Feb 7, 2019
1 parent 8e6f0cc commit b320d4e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions server/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"
"path"
"strings"
"time"

"github.com/Masterminds/sprig"
"github.com/gobuffalo/packd"
Expand Down Expand Up @@ -39,6 +40,7 @@ func (s *Server) Render(w io.Writer, name string, data interface{}, c echo.Conte
func (s *Server) getFuncmap() *ctxFuncmap {
f := &ctxFuncmap{}
f.fm = sprig.FuncMap()
f.fm["assetSuffix"] = func() string { return time.Now().String() }
f.fm["yolo"] = func() string { return "yolo" } // custom func example
f.fm["jobToPlatform"] = func(job string) string {
switch job {
Expand Down
2 changes: 1 addition & 1 deletion templates/layout/base.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<title>{{block "title" .}}{{end}} - Berty</title>
<meta http-equiv="refresh" content="30">
<link rel="stylesheet" href="/assets/site.css">
<link rel="stylesheet" href="/assets/site.css?{{assetSuffix}}">
{{block "head" .}}{{end}}
<meta name="msapplication-TileColor" content="#262844">
<meta name="theme-color" content="#262844">
Expand Down

0 comments on commit b320d4e

Please sign in to comment.