AndrewKlymchuk

AndrewKlymchuk

Hello folks! Are there any libraries for formatting of HEEx templates?

Showing Posts 19 to 10

marcin

marcin

Ay! Thanks for clarification!

valerian

valerian

In my case I didn’t need web-mode to understand them, I just cared about them being formatted by my CLI wrapper, so the hack was to replace the dot by some unique string, feeding that to web-mode for formatting, then replacing the unique string by a dot again :sweat_smile:

marcin

marcin

@valerian could you share how did you make web-mode understand <.tag> as a tag.
I’ve changed the web-mode-tag-regexp and web-mode-start-tag-regexp but this does not seem to work…

100phlecs

100phlecs

If you’re looking for a sorter, I’ve made one that integrates with mix format which may be of interest to you :slight_smile:

lessless

lessless

It seems to be pretty much impossible atm. I’ve tried GitHub - adamzapasnik/prettier-plugin-eex: Prettier EEX plugin · GitHub and it blew up on slots.

npx prettier --config .prettierrc.js sample.html.heex --tailwind-config=tailwind.config.js
sample.html.heex [error] sample.html.heex: SyntaxError: Unexpected closing tag "icon". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (81:21)
[error]   79 |                     <:icon>
[error]   80 |                       <MVIcons.x />
[error] > 81 |                     </:icon>
[error]      |                     ^^^^^^^^
[error]   82 |                     <:text>
[error]   83 |                       CANCEL
[error]   84 |                     </:text>
lessless

lessless

Thanks!

Did you manage to get Tailwind Prettier integration working?

Tam

Tam

Exactly what I was looking for; thank you!

mikeclark

mikeclark

Here’s my setup which seems to be working nicely.

Suggested tweaks welcome!

bpaulino0

bpaulino0

Little late to this post, but it’s now part of the phoenix_live_view library, so it’s easier to setup in a existing Phoenix project. the heex formatter can be configured with the mix format task with the following config in the .formatter.exs file:

plugins: [Phoenix.LiveView.HTMLFormatter],
inputs: [
  "*.{heex,ex,exs}", # <- include heex here 
  "priv/*/seeds.exs", 
  "{config,lib,test}/**/*.{heex,ex,exs}" # <- include heex here 
],
cvkmohan

cvkmohan

GitHub - feliperenan/heex_formatter: Formatter for Phoenix Live View templates. · GitHub is out and working well with elixir 1.13
It is working well with both ~H sigil and heex files.

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apz
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews