aboutsummaryrefslogtreecommitdiffstats
path: root/src/assets/sw_cache.11tydata.js
blob: 377753f920383dbc9023b40691afda5e304c4a6c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const crypto = require('crypto')

module.exports = () => {
    return {
        sw_cache: {
            offline: "/offline.html",
            default: [
                "/index.css",
                "/prism.css",
                "/index.js",
                "/favicon.svg",
                "/offline.html",
                "/"
            ],
        },
        eleventyComputed: {
            sw_cache: {
                store: data => `${data.env.CF_PAGES_BRANCH || "default"}-${data.env.CF_PAGES_COMMIT_SHA || crypto.randomUUID()}`
            }
        }
    }
}