superchris
Live-templates - connect a front-end template to a LiveState phoenix channel
live-templates is a library that allows you to drop a template into a static html website that will be connected to a LiveState phoenix channel on the backend. It eliminates the need to develop a custom element (or any other javascript) to build simple LiveState based applications. This is the very first release, so it’s early times, but it is far enough along to prove that the idea is viable and get deployed examples working. I’d love community feedback. This obviously overlaps with LiveView, but uses a somewhat different approach which makes it likely a better fit for cases such as static html websites or PWAs.
Most Liked
superchris
New version shipped as 0.4.0. Notably additions include:
- Upgraded to Sprae 9.0.1
- Declarative event sending eg
<button :sendclick="foo">instead of<button :onclick="sendEvent('foo'"> - Fully worked CRUD example
Next goal: client side navigation.
superchris
Those are interesting thoughts. I’m definitely a fan of Lit, but my goal with LiveState and by extension, live-templates is to keep as close as I can to web standards and avoid coupling to any particular implementation (eg Lit) as much as I can. This influenced my thoughts on template implementation as well. Though they are still developing, there are a couple of standards, template instantiation and DOM parts, that are making their way through the standards process and which the template library I chose is based on. This should make it pretty straightforward to swap out if I needed to, and to ditch altogether if templating makes it all the way into the browser.
As far as what you are talking about with heex rendering into lit element templates, this sounds a bit like the idea I was exploring that initially led me to create LiveState in the first place. I initially attempted to get Liveview to render into a custom element. I got some basic examples working with a greatly hacked version of Liveview, but it quickly became clear that it would require something close to a rewrite of Liveview for it to work. In a way, if you squint really hard, you can think of live-template as the very beginning of a possible reimagining or reimplemenation of Liveview, though it is much too soon to say how far it will get.
All that said though, I would absolutely welcome contributions. It is also quite possible I didn’t understand all your ideas, and sometimes seeing things in code makes is easier (at least for me) to grok than words.
superchris
Oh, and on the subject of PWA: on the next examples I plan to build is a PWA, I’ll add that to the README when I do.
Last Post!
anon9372508
Popular in Announcing
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex










