Run a dependency command when file changes

A generic solution is to use entr. GitHub - eradman/entr: Run arbitrary commands when files change · GitHub

It is a command line tool that lets you do anything when any files change.

For example, here is how I “re-create docs when any of the lib files change”:

find lib/ | entr -s 'mix format; mix docs -f html;'