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:
parent
c86a26959c
commit
5da2819c7d
@ -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 {
|
||||
|
@ -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">
|
||||
|
Loading…
x
Reference in New Issue
Block a user