128.io

inotify for efficient builds

2022-01-17

Project: Blog

When I moved the blog from raw HTML to a from-scratch static site generator, I initially used watch make build to run the build script, pause two seconds, and repeat endlessly. This worked, but would cause the build command to run even in scenarios where no files had been changed.


watch:
    while true; do \
      inotifywait -q -e create,delete,move,modify -r .; \
      $(MAKE) build; \
    done

Related Blog Entries