Automatic recompile on file change

How to automatically run a command on the change of a file

Today something simple: you are working on a file and would like to
execute a command whenever you save the file. In my case, I’m working on
a static page using Obelisk. Whenever I save a post I would like
to re-build the static files.

If you are using linux you need inotify and the you can issue the following command:

while true; do inotifywait -e modify files-to-observe; task-to-execute; done

For obelisk that could be:

while true; do inotifywait -e modify posts/*; mix obelisk build; done