by anoy8888 · 3y ago · 0 comments
The tricky part is that Elixir is compiled, and liveview templates are not "files" but functions.
From here you have two choices:
- You create a set of primitives (blocks), and the layout/arrangement of these primitives is configurable via a config map.
- Or you do a hot-code reload: Call an api, check if new code is available, fetch it, compile it (Code.compile_string), load it (:code.load_binary ), swap it for long running processes ( GenServer.code_change callback by example ), and remove old code ( :code.purge )
The first solution is safer. The second solution is a kind of black magic and you would need a way to authenticate de source code before compiling.