If you didn’t hear anything about using Elixir and Phoenix for building extremely high performance and low maintenance system, we are here to help you. Even more, we can tell you about something new! Meet Phoenix LiveView! It enables rich, real-time user experiences with server-rendered HTML.
Currently LiveView is under active development and we are focused on getting a stable and solid initial version out. For this reason, we will be accepting only bug reports in the issues tracker for now. We will open the issues tracker for features after the current milestone is ironed out.
- Currently, LiveView is only available from GitHub. To use it, add to your
- Once installed, update your endpoint’s configuration to include a signing salt. You can generate a signing salt by running
mix phx.gen.secret 32
- Update your configuration to enable writing LiveView templates with the
- Next, add the LiveView flash plug to your browser pipeline, after
- Then add the following imports to your web file in
- Next, expose a new socket for LiveView updates in your app’s endpoint module.
- Add LiveView NPM dependencies in your
- Then install the new npm dependency.
- Enable connecting to a LiveView socket in your
- Finally, by convention live views are saved in a
lib/my_app_web/live/directory. For live page reload support, add the following pattern to your
- You can also optionally import the style for the default CSS classes in your
For more information see here.
And we have an answer for you to the question of why Phoenix templates make web development so great. Don’t miss!