oklahomagugl.blogg.se

Elixir liveview
Elixir liveview













elixir liveview
  1. #ELIXIR LIVEVIEW CODE#
  2. #ELIXIR LIVEVIEW OFFLINE#

It hit on the idea of using an expressive language and a few well-chosen, unifying abstractions to drastically simplify development. And there's no JavaScript to write.ĭo you remember when Ruby on Rails was first released? I do. You just write HTML templates, and a stateful process synchronizes it with the browser, updating it only when needed. No GraphQL APIs, controllers, serializers, or resolvers. LiveView strips away layers of abstraction, because it solves both the client and server in a single abstraction. This is a post about how we created LiveView, our flagship feature. Phoenix provides features out-of-the-box that are difficult in other languages and frameworks. I work at Fly.io and created Phoenix, an Elixir web framework. the normal phoenix LiveView initialization, but passing in the hooks: Window.highlightAll(this.el) // this covers LiveView patches Window.highlightAll() // this covers on page load

elixir liveview

# config/dev.exs config :bern, BernWeb.Endpoint, live_reload : [ patterns : [ ~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$", ~r"lib/bern_web/(live|views)/.*(ex)$", ~r"lib/bern_web/templates/.*(eex)$", ~r"posts/*/.*(md)$" # = hljs.highlight(lang, block.innerText) Create a /blog folder, put your markdown in there, andĬonfigure Elixir to watch it for changes. NimblePublisher is a small system that sets up compiling Markdown files into In the context of a blog written with Markdown, I used

#ELIXIR LIVEVIEW CODE#

Let’s talk about it I’ll show you someĮlixir and Phoenix offer live-reloading when assets change (ie, JavaScript andĬSS), and code-reloading when Elixir code changes.

elixir liveview

Without a LiveView site? So, the trade-off is totally worth it to me. LiveView-powered components, and how else would I be able to show them off The “gaining” list is worth it to me, as an Elixir developer, because it unlocks

#ELIXIR LIVEVIEW OFFLINE#

Losing the PWA and cached offline access don’t bother me. Today don’t offer pre-compiled syntax highlighting, but I was using one, so it’sĪ loss for me. I was initially worried that moving a static site to an Elixir-powered webĪpplication would have too many trade-offs, but I was wrong! Many static sites With optimized images, but as far as I know, you’ll have to roll-your-own. It wouldn’t be impossible to have with a LiveView-powered blog The biggest reason is that Elixir lacks an asset-pipeline to You’re managing a huge static site with lots of pages perhaps look elsewhere at The “giving up” list doesn’t bother me too much, at least not on my blog. For example, when editing the post, IĬan save the file and my dev server shows the changes almost immediately. If there aren’tĪny other readers, then open a couple of tabs on this page, and watch theĪ reactive local development tool-chain. That’s enabled by LiveView and reacts immediately. If you didn’t notice, and if there is more than 1 current reader on thisĪrticle, look underneath the title of this article. The ability to send UI updates from the backend to the frontend efficiently.

elixir liveview

The ability to show off LiveView-enabled components (stay tuned!) Performance, I’m not too worried about this yet, and maybe I shouldn’t be forĪ tool-chain that I understand thoroughly and can contribute to I actually Scale static content using a CDN service. Gatsby has a great VSCode-poweredĪ mature asset-processing pipeline to optimizeĮasier scaling if traffic gets out of hand. I outline the features I lost, I gained, and some performance















Elixir liveview