A code formatter for Heex templates.
- Elixir 1.13
- Phoenix Live View 1.17.7
add :heex_formatter
as dependency
defp deps do
[
# ...
{:heex_formatter, github: "feliperenan/heex_formatter"},
]
end
Add it to your projects .formatter.exs
file
[
plugins: [HeexFormatter],
inputs: [
# ...
"*.{heex,ex,exs}",
"{config,lib,test}/**/*.{heex,ex,exs}"
],
]
Now run
mix format
The formatter defaults to a maximum line_length of 98 characters, which can be overwritten with the line_length
option in the .formatter
file.
Set heex_line_length
to only set the line:length for the heex formatter.
[
# ...omitted
heex_line_length: 300
]
Inspired by Surface Formatter.