eleventy-dev-server
eleventy-dev-server copied to clipboard
Request: Add option to not hot-reload certain file paths
Hello! I'm trying to upgrade my site to Eleventy 2.0.0 and the only feature I'm missing from the old BrowserSync server is the ability to not inject the snippet on certain pages.
I have a little in-browser editor for my blog and I run and use locally, and when I make edits in there it saves the changes back to the Markdown file on my filesystem. When this happens, it causes a page refresh, which blows away the state of my editor. I'd love to be able to tell Eleventy to not auto-reload that route specifically when a change is detected.
I was previously able to achieve this using this method in my Eleventy config:
config.setBrowserSyncConfig({
snippetOptions: {
ignorePaths: 'pathToIgnore/**',
},
})
My use-case is that I have some HTML files loaded in a "playground" component on some pages (using the playground-elements similar to https://lit.dev/playground), those HTML files aren't directly loaded (as HTML) by the browser but through a service worker, and their content is displayed in the playground editor; the injected reload-client script creates noise in the editor, and doesn't work in the preview pane as its origin is actually from unpkg.com. I'd like to be able to ignore those files.
I came here to request an equivalent to ignorePaths
also.
My use case is somewhat similar to @chasemccoy - I have a local page I use for data capture, which I don't want to get auto-reloaded such that I lose that data. Without ignorePaths
I'll have to be very careful when working on this page.