NOTE: Under Construction - I'm in the middle of upgrading my site and lots of stuff is kinda broken. Please forgive the mess.

Ignore Everything But The src Directory With Cargo Watch

March 2023

If you try to use watchexec with this setting it won't work. It doesn't pick the source directory back up

I'm working on the rebuild of my site. My test output is going into a site directory next to the src directory. This causes an issue with cargo watch where it gets stuck in a loop every time I build the site. (It sees a change in the directory then reruns the process.)

Passing --ignore flags to cargo watch is one solution. It would be tedious. Instead, I put a .ignore file in the root of the project with this in it:


That ignores everything with the *, but allows the src directory via the !src line. Combined that lets me edit anything outside the src directory without triggering cargo watch.

═══ § ═══