Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Ignore Everything But The src Directory With Cargo Watch

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:

Code

*
!src

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``.

Only run cargo watch when you want it to go