eleventy icon indicating copy to clipboard operation
eleventy copied to clipboard

v2.0 Dev Server options need better names

Open Zearin opened this issue 2 years ago • 1 comments

I was reading about the upcoming Dev Server in v2, and I noticed some issues with the option names.

I’ll go through the options that raised my eyebrow one by one:


// Opt-out of the live reload snippet
enabled: true,

Nothing in this option name says anything about live reload.

Put another way: Could you tell what this option does from eleventyConfig.setServerOptions({ enabled: true })?

To me, it looks like you are simply enabling the server.

I recommend something like enableLiveReload: true instead.


// Opt-out of DOM diffing updates and use page reloads
domdiff: true,

This is a trivial nitpick, but when all other options are camelCase, my brain wants this option to be domDiff so that it matches.


// Show local network IP addresses for device testing
showAllHosts: false,

This option name is decent, but I think something a little more specific would be even better (e.g., showLocalHosts or showLocalDevices).


// Change the name of the special folder name used for injected scripts
folder: ".11ty",

This option has the same issue as enabled. What does eleventyConfig.setServerOptions({ folder: '.11ty' }) tell you? I would probably read that and think it is setting the root folder to serve files from.

Additionally, since specifying folders is a really common configuration option, I recommend something like:

folder: {
    injectedScripts: ".11ty",
    // ... future folder-related configuration options can be added to `folder`
}

Zearin avatar Sep 05 '22 16:09 Zearin

As these suggestions are related to eleventy-dev-server, posting this in the corresponding repository would give them more visibility, IMHO.

jeromecoupe avatar Sep 06 '22 19:09 jeromecoupe

Ah, thanks for refiling! Closing this one—future visitors please subscribe to https://github.com/11ty/eleventy-dev-server/issues/41

zachleat avatar Dec 15 '22 21:12 zachleat