From 26aa65fe3122071c3a63a3355f917d7e1b854f6e Mon Sep 17 00:00:00 2001 From: Ken Hawkins Date: Wed, 8 Feb 2023 11:07:37 +0100 Subject: [PATCH] Configure new 11ty dev server --- eleventy.js | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/eleventy.js b/eleventy.js index 65b2be2..f82d08a 100755 --- a/eleventy.js +++ b/eleventy.js @@ -15,8 +15,44 @@ module.exports = function(config) { config.addPlugin(vfEleventyExtension); // BroswerSync options - config.setBrowserSyncConfig({ open: true }); + // config.setBrowserSyncConfig({ open: true, open: "local" }); + // 11ty version 2 has its own dev server + // https://www.11ty.dev/docs/dev-server/ + config.setServerOptions({ + // Default values are shown: + showVersion: true, + // Whether the live reload snippet is used + liveReload: true, + + // It cannot open a browser tab without hacks + // https://github.com/11ty/eleventy-dev-server/issues/28 + // open: true, + + // Whether DOM diffing updates are applied where possible instead of page reloads + domDiff: true, + + // The starting port number + // Will increment up to (configurable) 10 times if a port is already in use. + // port: 8080, + + // Additional files to watch that will trigger server updates + // Accepts an Array of file paths or globs (passed to `chokidar.watch`). + // Works great with a separate bundler writing files to your output folder. + // e.g. `watch: ["_site/**/*.css"]` + // watch: [], + + // Show local network IP addresses for device testing + showAllHosts: true, + + // Use a local key/certificate to opt-in to local HTTP/2 with https + https: { + // key: "./localhost.key", + // cert: "./localhost.cert", + }, + // Change the default file encoding for reading/serving files + encoding: "utf-8", + }); // Filters // https://www.11ty.io/docs/filters/ // -----