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
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
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
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}
Popular in Screencasts
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
- #javascript
- #code-sync
- #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
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








