Changing the browser-sync port in 11ty

8 feb 2020

Quick little tip, because I just had to figure it out by looking at three different sites and synthesizing information across them, and maybe I can save somebody else the trouble…

When you run eleventy --serve, it fires up a browser-sync process which, by default, binds to port 3001. Perhaps you, like me, have something else you run which also likes to grab port 3001, and you (like me!) don’t want to change that other thing to use another port. No, you (say it out loud, “like me”) want to make browser-sync use another damn port.

Toss this into your .eleventy.js and Bob, as the kids say, is your father’s brother:

// change browser-sync port
ui: {
port: 8079