# `PhoenixEmail.Tailwind.Compiler`
[🔗](https://github.com/gabrielperales/phoenix-email/blob/v0.1.2/lib/phoenix_email/tailwind/compiler.ex#L1)

Runs the real `tailwindcss` binary over your sources and converts its
output into the class → inline-declarations map used by
`PhoenixEmail.Tailwind` at render time.

Works with Tailwind v3 and v4 binaries — the version is detected and both
the invocation and the CSS post-processing adapt. Normally invoked through
`mix phoenix_email.tailwind`.

# `parse`

Parses tailwind's CSS output (v3 or v4) into a class → inline-declarations
map.

Email-oriented post-processing:

  * custom properties are resolved from the rule itself, `:root`/universal
    selectors, and `@property` initial values, then dropped; declarations
    with an unresolvable `var()` are discarded
  * `calc()` chains of `*` and `/` over numbers are evaluated
  * `rem` becomes px (x16); `rgb(r g b / a)` and `oklch()` become hex (or
    `rgba()` when translucent); `color-mix(..., transparent)` becomes
    `rgba()`
  * logical properties (`padding-inline`, …) become physical pairs (ltr)
  * at-rule blocks (`@media`, `@supports`) and pseudo-class selectors are
    skipped — variants cannot be inlined

# `resolve_binary`

Finds the tailwind binary: `:tailwind_bin` config, the tailwind hex
package, `tailwindcss` in `$PATH`, or — as a fallback — a Tailwind
v4.3.2 CLI installed with npm into a cached
directory. New Phoenix projects ship the hex package with v4, so that is
the path most apps take.

Returns `{:ok, command, prefix_args, input_base_dir}` — the last element
forces the generated input CSS to live next to the npm `node_modules` so
the CLI can resolve its imports (`nil` for standalone binaries).

# `run`

Compiles the map and writes it to `PhoenixEmail.Tailwind.map_path/0`.

## Options

  * `:content` - glob patterns to scan (default: the `:tailwind_content`
    config key, or `["lib/**/*.ex"]`)
  * `:config` - a `tailwind.config.js` (v3, or v4 via `@config`) or a CSS
    entry point with your `@theme` (v4) to use instead of the generated
    input (default: the `:tailwind_config` config key)
  * `:output` - where to write the map (default: `map_path/0`)

Returns `{:ok, map}` or `{:error, reason}`.

---

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