1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-03-25 21:39:02 +02:00

Add cache-busting version.

This commit is contained in:
Alec Thomas 2019-07-16 22:19:43 +10:00
parent c86a26959c
commit 5da2819c7d
2 changed files with 4 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package main
import (
"encoding/json"
"fmt"
"html/template"
"log"
"net/http"
@ -35,6 +36,7 @@ type context struct {
SelectedStyle string
Styles []string
CSRFField template.HTML
Version string
}
func index(w http.ResponseWriter, r *http.Request) {
@ -122,6 +124,7 @@ func newContext(r *http.Request) context {
ctx := context{
SelectedStyle: "monokailight",
CSRFField: csrf.TemplateField(r),
Version: fmt.Sprintf("%d", staticFiles.Time().Unix()),
}
style := styles.Get(ctx.SelectedStyle)
if style == nil {

View File

@ -10,14 +10,13 @@
#output {
{{.Background}};
overflow-x: scroll;
}
#output pre {
padding: 0;
}
</style>
<script src="static/index.js"></script>
<script src="static/index.js?{{.Version}}"></script>
</head>
<body>
<div class="container">