Module

core.site.theme

Theme integration mixin for Site.

Provides methods for theme resolution and asset chain discovery.

Related Modules:

  • bengal.core.site.core: Main Site dataclass using this mixin
  • bengal.core.theme: Theme configuration
  • bengal.utils.theme_resolution: Theme inheritance chain resolution

Classes

ThemeIntegrationMixin
Mixin providing theme integration methods. Requires these attributes on the host class: - root…
2

Mixin providing theme integration methods.

Requires these attributes on the host class:

  • root_path: Path
  • theme: str | None

Attributes

Name Type Description
root_path Path
theme str | None
Internal Methods 2
_get_theme_assets_dir
Get the assets directory for the current theme. Searches for theme assets in o…
0 Path | None
def _get_theme_assets_dir(self) -> Path | None

Get the assets directory for the current theme.

Searches for theme assets in order:

  1. Site's themes directory (site/themes/{theme}/assets)
  2. Bengal's bundled themes (bengal/themes/{theme}/assets)
Returns

Path | None

Path to theme assets directory, or None if theme not found or assets directory doesn't exist

_get_theme_assets_chain
Return list of theme asset directories from inheritance chain. Returns asset d…
0 list[Path]
def _get_theme_assets_chain(self) -> list[Path]

Return list of theme asset directories from inheritance chain.

Returns asset directories in order from parent themes to child theme (low → high priority). Site assets override all theme assets.

Returns

list[Path]

List of Path objects for theme asset directories, ordered from parent (low priority) to child (high priority). Empty list if no theme assets found.

Priority Order (lowest to highest): 1. Default theme assets (if extended) 2. Parent theme assets (if extended) 3. Child theme assets 4. Site assets (highest priority, handled separately)