mirror of
https://github.com/alex-shpak/hugo-book.git
synced 2024-11-21 19:09:29 +00:00
Add precache to service worker
This commit is contained in:
parent
e2ffa7b3ad
commit
a877c17dc1
@ -1,4 +1,4 @@
|
||||
{{ $swJS := resources.Get "sw.js" | resources.ExecuteAsTemplate "sw.js" . }}
|
||||
{{- $swJS := resources.Get "sw.js" | resources.ExecuteAsTemplate "sw.js" . -}}
|
||||
if (navigator.serviceWorker) {
|
||||
navigator.serviceWorker.register(
|
||||
"{{ $swJS.RelPermalink }}",
|
||||
|
@ -1,8 +1,10 @@
|
||||
const cacheName = self.location.pathname
|
||||
const pages = [
|
||||
{{ if eq .Site.Params.BookServiceWorker "precache" }}
|
||||
{{ range .Site.AllPages -}}
|
||||
"{{ .RelPermalink }}",
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
{{ end }}
|
||||
];
|
||||
|
||||
self.addEventListener("install", function (event) {
|
||||
|
Loading…
Reference in New Issue
Block a user