# `Biomine.LiveView.TagFormatter`
[🔗](https://github.com/wingyplus/biomine/blob/main/lib/biomine/live_view/tag_formatter.ex#L2)

A `Phoenix.LiveView.HTMLFormatter.TagFormatter` implementation that formats
the contents of `<script>` and `<style>` tags with Biomine.

This is useful for formatting [colocated
hooks](https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.ColocatedHook.html)
and [colocated
CSS](https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.ColocatedCSS.html)
embedded in `.heex` templates and `~H` sigils.

## Setup

Add it as a `:tag_formatters` entry alongside `Phoenix.LiveView.HTMLFormatter`
in your `.formatter.exs` file:

```elixir
[
  plugins: [Phoenix.LiveView.HTMLFormatter],
  tag_formatters: %{script: Biomine.LiveView.TagFormatter, style: Biomine.LiveView.TagFormatter},
  inputs: [
    "{mix,.formatter}.exs",
    "{config,lib,test}/**/*.{ex,exs,heex}"
  ]
]
```

Formatter options can be passed under `biomine: [js: ..., css: ...]`, same
as `Biomine.Mix.JsFormatter` and `Biomine.Mix.CssFormatter`:

```elixir
[
  plugins: [Phoenix.LiveView.HTMLFormatter],
  tag_formatters: %{script: Biomine.LiveView.TagFormatter, style: Biomine.LiveView.TagFormatter},
  biomine: [
    js: [quote_style: :single, semicolons: :as_needed],
    css: [quote_style: :single]
  ],
  inputs: [
    "{mix,.formatter}.exs",
    "{config,lib,test}/**/*.{ex,exs,heex}"
  ]
]
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
