slouchpie

slouchpie

"mix format" for html.eex and html.leex files?

Is there any mix task (or github repo) that provides formatting of html.eex and html.leex files? It seems like every text editor and IDE has its own weird solution for formatting these files so I wonder is there some ubiquitous tool for formatting these files?

Most Liked

slouchpie

slouchpie

Writing this for posterity:

Currently I do it using the Ruby Gem htmlbeautifier (thanks @Kurisu) .

To setup:

Install ruby with:

$ asdf plugin-add ruby
$ asdf install ruby 3.0.0-dev
$ asdf global ruby 3.0.0-dev

Open a new shell and:

$ gem install html beautifier

Then to format at any time, do something like this:

$ find lib -name "*.html.*eex" | xargs ~/.asdf/installs/ruby/3.0.0-dev/bin/htmlbeautifier
Kurisu

Kurisu

Hello I’m using this one (vscode-eex-format). But it requires to have ruby and its gem " htmlbeautifier" installed to work.

For the job it does I think it’s worth it.

slouchpie

slouchpie

This is good because it can be run from the command line and is editor-agnostic.

Unfortunately it requires installing ruby.

@Kurisu Do you have some way of using this in a CI pipeline? I would like to format html.eex file automatically in CI.

Where Next?

Popular in Questions Top

Tee
can someone please explain to me how Enum.reduce works with maps
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
dokuzbir
Hello, I am trying to convert my lists to string without losing brackets.For start i have 3 map. They look like these buyer = %{ id: ...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
Fl4m3Ph03n1x
Background Let’s assume I have a typical GenServer that receives messages as requests, does some operation in a DB and returns responses....
New
chewm
Hi guys, nice to meet you to the whole forum, I’m new here, I’m trying to configure visual studio code for elixir, right now the intellis...
New
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
jc00ke
Expanding on this topic: https://forum.elixirforum.net/t/map-typespec-question/19217 Let’s say I have a map with required and optional k...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

Other popular topics Top

William
I would like to know that is there any online source for learning Phoenix Framework for building E-Commerce Store? Any advantage on build...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New

We're in Beta

About us Mission Statement