diff --git a/_data/site.yaml b/_data/site.yaml index ac07271..6bf38da 100644 --- a/_data/site.yaml +++ b/_data/site.yaml @@ -10,4 +10,4 @@ github_repo: https://github.com/ReduxStation/website # Set to "" to disable the poller and show "server status unavailable". status_endpoint: "/serverinfo.json" -poll_interval_ms: 4000 +poll_interval_ms: 1000 diff --git a/eleventy.config.js b/eleventy.config.js index aeec942..b9d5bd3 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -16,6 +16,17 @@ module.exports = function (eleventyConfig) { eleventyConfig.addNunjucksAsyncShortcode("webpack", shortcodes.webpack); eleventyConfig.addShortcode("currentBuildDate", () => new Date().toISOString()); + // Cache-bust query string baked at build time. Webpack's manifest plugin + // does not add [contenthash] to the copied JS bundles (they go through + // CopyWebpackPlugin, not webpack's regular pipeline), so the + // /assets/js/*.js URLs are stable. Caddy serves /assets/* with + // Cache-Control: max-age=31536000, so without this query string a + // browser that fetched the JS once would never refetch after a content + // change. Pinning to one buildId per `npm run build` flushes caches + // exactly when assets actually change. + const buildId = Date.now().toString(36); + eleventyConfig.addShortcode("buildId", () => buildId); + eleventyConfig.addWatchTarget(path.join(__dirname, "_site/assets/manifest.json")); eleventyConfig.addWatchTarget(path.join(__dirname, "_data/*.yaml")); diff --git a/index.njk b/index.njk index 7bb2be1..af2cc37 100644 --- a/index.njk +++ b/index.njk @@ -6,7 +6,7 @@