diff --git a/.eleventy.js b/.eleventy.js index c4657e6..4a52805 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -201,21 +201,6 @@ module.exports = function (eleventyConfig) { }); eleventyConfig.setLibrary("md", markdownLibrary); - // Browsersync Overrides - eleventyConfig.setBrowserSyncConfig({ - callbacks: { - ready: function (err, browserSync) { - browserSync.addMiddleware("*", (req, res) => { - // Provides the 404 content without redirect. - res.write(fs.readFileSync("_site/404.html")); - res.end(); - }); - }, - }, - ui: false, - ghostMode: false, - }); - // After the build touch any file in the test directory to do a test run. eleventyConfig.on("afterBuild", async () => { const files = await readdir("test"); diff --git a/_11ty/apply-csp.js b/_11ty/apply-csp.js index 5759f96..d1bd844 100644 --- a/_11ty/apply-csp.js +++ b/_11ty/apply-csp.js @@ -21,7 +21,6 @@ const { JSDOM } = require("jsdom"); const cspHashGen = require("csp-hash-generator"); -const syncPackage = require("browser-sync/package.json"); /** * Substitute the magic `HASHES` string in the CSP with the actual values of the @@ -29,18 +28,6 @@ const syncPackage = require("browser-sync/package.json"); * The ACTUAL CSP is configured in `_data/csp.js`. */ -// Allow the auto-reload script in local dev. Would be good to get rid of this magic -// string which would break on ungrades of 11ty. -const AUTO_RELOAD_SCRIPTS = [ - quote( - cspHashGen( - "//<\\/script>".replace("HOST", location.hostname));\n//]]>' - ) - ), -]; - function quote(str) { return `'${str}'`; } @@ -59,9 +46,6 @@ const addCspHash = async (rawContent, outputPath) => { element.setAttribute("csp-hash", hash); return quote(hash); }); - if (isDevelopmentMode()) { - hashes.push.apply(hashes, AUTO_RELOAD_SCRIPTS); - } const csp = dom.window.document.querySelector( "meta[http-equiv='Content-Security-Policy']" @@ -103,7 +87,3 @@ module.exports = { eleventyConfig.addTransform("csp", addCspHash); }, }; - -function isDevelopmentMode() { - return /serve|dev/.test(process.argv.join()); -}