webserver auto restart

Currently MAC only.

a way to get the webserver to restart when files under the UI folder change

$ brew install fswatch
 

then create a file in the main directory of your app called restart.sh with contents

#!/bin/bash
echo 'kill running server'
ps | grep "[h]cdev" | awk '{if($1!="") {print "killing process: "$1; system("kill " $1)}}'
echo 'starting server' hcdev web &
 

then change the permissions of that file to executable

$ chmod a+x restart.sh

then run the command and it will watch the UI folder for file changes and restart the webserver when files change (and are saved)

fswatch ./ui | xargs -n1 './restart.sh'
 
Finally, and don't miss this step. Run
touch ui/index.html
This will run the process the first time, and get your webserver going.