Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elm make on save, hot reload

Tags:

elm

I have elm reactor serving my pages while developing. After saving my code changes, I am running elm make src/Main.elm --output=main.js. Is there a way to auto elm make on save and see the changes on the browser?

I'm using elm 0.19

like image 793
C.S.Reddy Gadipally Avatar asked Apr 24 '19 02:04

C.S.Reddy Gadipally


2 Answers

Update for 2021: These days I would just use Parcel JS. It support hot reloading and is easy to setup in general: https://parceljs.org/elm.html

Old answer: I had the same issue.

At first I used a custom script in my Atom environment, but then I found Elm Live: https://github.com/wking-io/elm-live.

Does all you ask. Highly recommended! Automatically recompiles, hot reloads and opens the browser window if not opened.

First install with NPM: (I used some issues with the latest version)

npm install --save-dev elm elm-live

Then use the command instead of the one you're using now:

elm-live src/Main.elm --open -- --output=main.js

like image 109
Tails Avatar answered Oct 18 '22 05:10

Tails


I think you'll need to use a proper build environment to get hot reloading. The one I created and use is at https://github.com/simonh1000/elm-webpack-starter

like image 33
Simon H Avatar answered Oct 18 '22 05:10

Simon H