elm-reactor icon indicating copy to clipboard operation
elm-reactor copied to clipboard

Support custom index.html entrypoint

Open danneu opened this issue 9 years ago • 5 comments

As an Elm beginner, I quickly got to a point where I had a custom index.html file (to link in my custom CSS files) which mounted my src/Main.elm file. For example, I almost always start a project with Twitter Bootstrap so I have some basic UI components to play with while prototyping as it's a chore to prototype with unstyled HTML.

My envisioned workflow would be to run elm-reactor, open my index.html, and refresh the page as I make changes to my src/**.elm files (bonus: hot reload).

elm-reactor doesn't support this afaict, and I'm not fully understood in the intended scope of elm-reactor, but it seems like this an obvious responsibility for elm-reactor or at least some core component of Elm's built-in tools.

So far I have a script that watches the filesystem and re-runs elm-make on change. And it doesn't seem like this is uncommon or already supported by Elm tooling (https://langrisa.eu/auto-recompile-using-your-own-html/).

What do you think?

danneu avatar Nov 21 '15 21:11 danneu

Have you seen https://github.com/elm-lang/elm-reactor#debugging-code-embedded-in-html?

jvoigtlaender avatar Nov 21 '15 21:11 jvoigtlaender

That bit got removed from the README. I've dug through the code, and can't find custom index.html support. Afaik, custom HTML is required to use ports.

tmcw avatar Sep 17 '16 23:09 tmcw

Yes, it appears that got removed at some point in the last 10 months. The reactor is undergoing a revamp. When that is done, you can probably expect complete instructions for this use case again. In the meantime, you could ask on the mailing list how people cope with this issue right now.

jvoigtlaender avatar Sep 18 '16 05:09 jvoigtlaender

For OSX users, fswatch seems to do the trick of kicking elm-make to recompile the sources for elm-reactor to serve:

fswatch -o ./src/ | while read; do elm-make src/Main.elm --output out/main.js; done

Although any static web server would do instead of elm-reactor in this case.

shishkin avatar Apr 01 '17 04:04 shishkin

Is there any progress on this issue? There are workarounds, however, they very much depend on all sorts of external factors, like OS, node version, how node is installed (nvm?) etc... So, I more reliable solution would be great.

halcwb avatar Jul 11 '17 13:07 halcwb