Skip to content

Formatter for Phoenix Live View templates.

Notifications You must be signed in to change notification settings

nicocirio/heex_formatter

 
 

Repository files navigation

HeexFormatter

ElixirCI

A code formatter for Heex templates.

⚠️ This project is still in alpha stage. There are several cases yet to be handled.

Pre-requisites

  • Elixir 1.13
  • Phoenix Live View 1.17.7

Installation

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

options

line_length

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.

About

Formatter for Phoenix Live View templates.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Elixir 100.0%