sergio

sergio

Phoenix Liveview Templates - automatic formatting using Prettier

Here’s a quick 3 minute video explaining how to get a great workflow for Phoenix Liveview templates. Good dev ux!

Most Liked

sergio

sergio

It does, works great! Just make sure you add the file association for .heex templates.

"files.associations": {
  "*.eex": "html-eex",
  "*.leex": "html-eex",
  "*.heex": "html-eex"
},
cvkmohan

cvkmohan

using prettier-plugin-eex has several problems in the formatting. It replaces code with <eext1 /> in many cases.
Further, it does not handle heex files well. For example <link phx-track-static rel="stylesheet" href={Routes.static_path(@conn, "/assets/app.css")} /> this line generates an error - because href={} is not handled correctly.
If you are using surface, far superior solution is GitHub - surface-ui/surface_formatter · GitHub.
In the upcoming elixir 1.13 release, custom formatters are supported https://github.com/elixir-lang/elixir/pull/11246 - and - we should expect a good elixir formatter that understands both HTML and elixir interpolation should arrive.

Nefcairon

Nefcairon

You can also use it for .sface. It just doesn’t reformat constructs like:

{#for item <- @list}
<h1>Item: {item}</h1>
{#else} No items {/for}

Where Next?

Popular in Screencasts Top

zacksiri
Hey all! We just released 3 episodes on our site explaining how GenServer works. We also released a free episode that shows you how to s...
New
dgamidov
So cool! @pragdave New (short) screencast about making pipelines more functional with anonymous functions. Put This in Your Pipe(line)
New
AlchemistCamp
https://alchemist.camp/episodes/word-count I’ve just made a new version of of Lesson 2 from Alchemist Camp. It has significantly larger ...
New
aseigo
New video covering, at least in brief, the current date and time APIs in Elixir. I do hope that more of Calendar / Timex a...
New
remzolotykh
Hi all. I’m new here and kinda new to Elixir and Phoenix, but I love it so much. These days PETAL stack is my favourite way to build apps...
New
ElixirCasts
I made an screencast that looks at Sobelow, a project that scans Phoenix applications for security issues. If you haven’t used Sobelow be...
New
omgneering
Up and Running - Elixir Phoenix on Digital Ocean A playlist of videos that go through basic app creation, getting a Digital Ocean server...
New
hubertlepicki
So I just recorded this one where I build simple command-line tool in Elixir using TDD with ExUnit. Hope you like it :slight_smile:
New
hubertlepicki
I have been learning GraphQL as it seems to be something we will need to be using in upcoming projects, and I like to document things as ...
New
anuragg
One of our users just created this screencast for deploy Elixir apps on Render. Hope it’s helpful! https://twitter.com/Alc...
New

Other popular topics Top

albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New

We're in Beta

About us Mission Statement