Multitenancy (multitenancy_phoenix v0.1.0)

Copy Markdown View Source

Host-resolved multi-site theming for Phoenix.

A request host is resolved to a Multitenancy.Site, each site points to a theme living under themes/<name>/, and every theme is a self-contained slice of the application with its own router, controllers, templates, layouts, assets and gettext backend. Templates missing from a theme fall back to the base application (see Multitenancy.HTML).

Summary

Functions

Hosts served by the platform router instead of a theme.

The configured Multitenancy.SiteResolver implementation.

Fetches the theme definition for name.

The module conventionally defining the theme name, e.g. Themes.MyStore.

Names of the theme directories found under themes_path/0.

Directory holding the themes, relative to the project root.

Functions

platform_hosts()

Hosts served by the platform router instead of a theme.

resolver()

The configured Multitenancy.SiteResolver implementation.

theme(name)

@spec theme(String.t() | atom()) :: {:ok, Multitenancy.Theme.t()} | :error

Fetches the theme definition for name.

theme!(name)

@spec theme!(String.t() | atom()) :: Multitenancy.Theme.t()

Same as theme/1 but raises Multitenancy.ThemeNotFoundError.

theme_module(name)

The module conventionally defining the theme name, e.g. Themes.MyStore.

theme_names(root \\ themes_path())

Names of the theme directories found under themes_path/0.

themes_path()

Directory holding the themes, relative to the project root.