elm-reactworks wonderfully when your entire project is in elm. However, you often embed Elm into a larger application.
index.htmlwill look something like this:
<div id="main"></div> <script src="main.js"></script> <script> var node = document.getElementById('main'); var app = Elm.Main.embed(node); </script>
inotifywaitcommand. With it, you can run a command on file modifications.
inotifywait -e modify -m . | while read file; do elm-make Main.elm --output SOME_DIRECTORY_SOMEWHERE/main.js; done
inotify-toolsand then you can wait for a file to change using:
inotifywait -m thefile.txt
-mflag monitors the file, instead of exiting on the first event. You can use
-eto wait for a particular event--see the man page.
inotifywait -m thefile.txt | while read file; do echo $file; done
filein this case will have the file name and event name, but you don't need to use it obviously.
bash bash-while inotifywait unixPage 1 of 1