11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.
https://www.11ty.dev/
MIT License
17.18k stars 494 forks source link

Eleventy watcher ignores *unlink* events #2272

Closed genemars closed 2 years ago

genemars commented 2 years ago

I was wondering why 11ty does not implement watching of "unlink" events. When files are deleted from input folder, Eleventy does nothing, not even trigger the browser refresh. This looks like kind of a bug when deleting an Item that, for instance, is listed on a menu. The item appears to be still there and can also be opened. The only way to update the page is to stop Eleventy, delete output folder, and restart it. Watching/syncing of deleted files would be a nice feature to have, at least as a switchable configuration option.

genemars commented 2 years ago

I solved writing a separate watcher for passthroughCopyFiles

davidvasandani commented 1 year ago

@genemars could you share your fix? 🙏🏻

genemars commented 1 year ago

You can find the fix in my Eleventy-based web-starter. In particular this is the code that does the trick. The code is not reusable as-is since it takes care of other things as well, but should give an idea of how the fix works.