# `Expresso.PathTransformer`
[🔗](https://github.com/rellen/expresso/blob/main/lib/expresso/path_transformer.ex#L1)

The Spark transformer of the paths of a deck

It runs one time for each deck module at compile time, and before
`Expresso.Overlay.Transformer`. When the deck has the `root` option, it
joins each relative path of the deck to that directory: the `src` of an
image, a diagram, a code element, a local embed, a video and a sound, the
`fallback` of an embed, the `poster` of a video, the `image` of a node of a
tree, and the `css` option when it is a path. An absolute path and the address of an embed stay as they
are. The option itself becomes an absolute
path, so the renderer can resolve a `url()` of an inline style sheet.

Then it builds each code element with `src`: it reads the file, and it
makes the groups of lines with `Expresso.Element.Code.build/1`. It builds
a chart and a tree with `src` from their files in the same way. The entity
of a code element cannot read the file, because the `root` option of the
deck is not known when the entity is made. An error of the build becomes a
`Spark.Error.DslError` with the path of the slide.

`docs/reference/root-option.md` gives the rules.

# `after?`

# `after_compile?`

# `before?`

```elixir
@spec before?(module()) :: boolean()
```

Run this transformer before the overlay transformer, which needs the groups of lines

# `transform`

```elixir
@spec transform(map()) :: {:ok, map()} | {:error, Spark.Error.DslError.t()}
```

Join each relative path of the deck to the root, and build each code element with `src`

---

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