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

how to pass elm flags

Open johndeighan opened this issue 5 months ago • 1 comments

I love the fact that I can just globally install elm and elm-live, do an "elm init", create a src/Main.elm file and invoke elm-live. Short and simple. But to make my app responsive, I need to 1) respond to "window resized" events and 2) initially, get the window size. From research, I see that to get the initial window size, I need to pass in elm flags in the index.html file:

<script>
let app = Elm.Main.init({
flags: {
windowHeight: window.innerHeight,
windowWidth: window.innerWidth
}
})
</script>

Well, darn... I didn't want to have to mess with index.html - elm-live creates that automatically for me.

I tried to edit the index.html file created, but unfortunately, elm-live rebuilds it each time it's run. Is there some way to handle this without having to change my development process?

johndeighan avatar Sep 08 '24 07:09 johndeighan