-
I think this is a best practices question. I'm trying to figure out which command I should be running with Netlify CLI. Netlify recommends The docs also recommend using 8080, but that conflicts with Browsersync. Is the solution here just as simple as ignoring the server running on 8888? package.json: "scripts": {
"start": "netlify dev",
"build": "NODE_ENV=production eleventy",
"dev": "FORCE_COLOR=true eleventy --serve"
}, netlify.toml: [build]
command = "npm run build"
publish = "dist"
[dev]
command = "npm run dev"
# port = 8080 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Eleventy has 2 modes for watching files for changes, the first of which you already mentioned: Is there a reason you're keen to use the Netlify CLI for local development? Unless you want to test your Netlify configurations before deploying anything, even for previewing purposes, or test any serverless logic, browser-sync offers a whole bunch of stuff out of the box that I personally find more than enough for my own local development needs. The other benefit of using browser-sync internally with Eleventy is that there's no need to configure hooks or logic to get live-reloading working; Eleventy will handle all of that for you when a rebuild is triggered. Hope this helps! More documentation is available here (https://www.11ty.dev/docs/watch-serve/) on configuring the |
Beta Was this translation helpful? Give feedback.
-
Maybe I'm not getting the issue - but what is wrong with having it on two ports? I run like so:
And I get Eleventy reloading properly as well as my Netlify stuff (serverless funcs) running well. I ignore the port used by Eleventy and use the port Netlify runs on (and as it opens a browser tab for me, it makes it easy). |
Beta Was this translation helpful? Give feedback.
Eleventy has 2 modes for watching files for changes, the first of which you already mentioned:
eleventy --serve
. There is another one,eleventy --watch
which will process files as they change on disk, without spinning up a local browser-sync instance. See: https://www.11ty.dev/docs/usage/#re-run-eleventy-when-you-save for more info.Is there a reason you're keen to use the Netlify CLI for local development? Unless you want to test your Netlify configurations before deploying anything, even for previewing purposes, or test any serverless logic, browser-sync offers a whole bunch of stuff out of the box that I personally find more than enough for my own local development needs. The other ben…