Cherry.Theme.ComponentLoader (cherry v0.2.0)

Copy Markdown View Source

Loads a theme's components.exs: an optional file at the theme root defining function-component modules (use Phoenix.Component) that every HEEx template in that theme can call as <.name …>.

Compiled at runtime — the same escape-hatch mechanism as theme.exs and site extension scripts (ADR 0002), so binary-mode sites get the full feature. Compilation is cached on the file's content hash; cherry serve picks up edits because a changed file is a changed hash, and the stale modules are purged before the recompile.

Summary

Functions

The modules defined by this theme's components.exs, compiled and cached; [] when the theme has none.

Functions

modules(theme_root)

@spec modules(Path.t()) :: {:ok, [module()]} | {:error, String.t()}

The modules defined by this theme's components.exs, compiled and cached; [] when the theme has none.