Server side rendering with phoenix and elm

any guide or clue on how to achieve that ?

I think you meant to ask how to achieve that.

The problem is that Elm generates JavaScript that is designed to be run in a browser context (ie, where a DOM is available). Presumably you could get server side rendering using something like a headless browser?

1 Like

I had tried that but the headless browser like hound doesn’t wait for the page to be loaded

Last I checked Elm was not at all Server-rendering friendly, so you may not be able to as of yet. Even when it is capable of it, it cannot compile to a native backend or NIF like OCaml or Rust or so can so you’d end up having to run an instance of nodejs on the server too, which is a bit blehg… ^.^;

3 Likes

I see, thank you for the information. currently I am hacking my way by inject the meta tag using the phoenix rendering template instead. even though it have to do two round trip for the same data but at least it was way easier.