As this answer shows it's possible in Elm 0.18 to run elm reactor with a custom HTML file if this snippet is included in the HTML file:
<script src="/_compile/src/Main.elm"></script>
<script>
runElmProgram();
</script>
In 0.19, however, it doesn't seem like the _compile directory exists or is served anymore. Is there another way to accomplish the same, preferably with elm reactor so as to be able to leverage existing IDE support etc., but I'm interested in any kind of "dev server" solution.
It's possible to use
elm-live, which needs to be invoked with a bit more ceremony. It defaults to servingindex.htmlbut can be configured to serve a different html page using the command line option-s, --start-page [STARTPAGE](Thank you for this tip, @kaskelotti)The equivalent snippet needed in
index.htmlto start your elm program is:and to start it run the following command in a terminal:
The script path in the HTML file must be the same as the one passed as
outputon the command line.Unlike
elm reactor,elm-livewill not display compiler errors in the browser, but instead prints it to the terminal, and will continue to serve the last successfully compiled output.It also randomly hangs and crashes...