Functions
theme
Theme utilities (list/info/discover/install, swizzle).
theme
def theme() -> None
Theme utilities (list/info/discover/install, swizzle).
swizzle
🎨 Copy a theme template/partial to project templates.
Swizzling copies a template from the active …
swizzle
def swizzle(template_path: str, source: str) -> None
🎨 Copy a theme template/partial to project templates.
Swizzling copies a template from the active theme to your project's templates/ directory, allowing you to customize it while tracking provenance for future updates.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
template_path |
str |
— | |
source |
str |
— |
swizzle_list
📋 List swizzled templates.
Shows all templates that have been copied from themes to your project,
…
swizzle_list
def swizzle_list(source: str) -> None
📋 List swizzled templates.
Shows all templates that have been copied from themes to your project, along with their source theme for tracking.
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
source |
str |
— |
swizzle_update
🔄 Update swizzled templates if unchanged locally.
Checks swizzled templates and updates them from …
swizzle_update
def swizzle_update(source: str) -> None
🔄 Update swizzled templates if unchanged locally.
Checks swizzled templates and updates them from the theme if you haven't modified them locally. Templates you've customized are skipped.
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
source |
str |
— |
list_themes
📋 List available themes.
Shows themes from three sources:
- Project themes: themes/ directory in y…
list_themes
def list_themes(source: str) -> None
📋 List available themes.
Shows themes from three sources:
- Project themes: themes/ directory in your site
- Installed themes: Themes installed via pip/uv
- Bundled themes: Themes included with Bengal
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
source |
str |
— |
info
ℹ️ Show theme info for a slug.
Displays information about a theme including:
- Source location (p…
info
def info(slug: str, source: str) -> None
ℹ️ Show theme info for a slug.
Displays information about a theme including:
- Source location (project, installed, or bundled)
- Version (if installed)
- Template and asset paths
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
slug |
str |
— | |
source |
str |
— |
discover
🔍 List swizzlable templates from the active theme chain.
Shows all templates available in your act…
discover
def discover(source: str) -> None
🔍 List swizzlable templates from the active theme chain.
Shows all templates available in your active theme(s) that can be swizzled (copied) to your project for customization.
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
source |
str |
— |
debug
🐛 Debug theme resolution and template paths.
Shows comprehensive information about:
- Active theme…
debug
def debug(source: str, template: str | None) -> None
🐛 Debug theme resolution and template paths.
Shows comprehensive information about:
- Active theme chain (inheritance order)
- Template resolution paths (priority order)
- Template source locations
- Theme validation (circular inheritance, missing themes)
- Specific template resolution (if --template provided)
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
source |
str |
— | |
template |
str | None |
— |
_get_theme_extends
Get the theme that a theme extends.
_get_theme_extends
def _get_theme_extends(site_root: Path, theme_name: str) -> str | None
Get the theme that a theme extends.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
site_root |
Path |
— | |
theme_name |
str |
— |
Returns
str | None
_validate_theme_chain
Validate theme chain and return list of issues.
_validate_theme_chain
def _validate_theme_chain(site_root: Path, active_theme: str | None) -> list[str]
Validate theme chain and return list of issues.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
site_root |
Path |
— | |
active_theme |
str | None |
— |
Returns
list[str]
_theme_exists
Check if a theme exists in any location.
_theme_exists
def _theme_exists(site_root: Path, theme_name: str) -> bool
Check if a theme exists in any location.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
site_root |
Path |
— | |
theme_name |
str |
— |
Returns
bool
_get_template_dir_source_type
Determine the source type of a template directory.
_get_template_dir_source_type
def _get_template_dir_source_type(site_root: Path, template_dir: Path) -> str
Determine the source type of a template directory.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
site_root |
Path |
— | |
template_dir |
Path |
— |
Returns
str
install
📦 Install a theme via uv pip.
Installs a theme package from PyPI. NAME may be a package name or a …
install
def install(name: str, force: bool) -> None
📦 Install a theme via uv pip.
Installs a theme package from PyPI. NAME may be a package name or a slug. If a slug without prefix is provided, suggests canonical 'bengal-theme-<slug>'.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
name |
str |
— | |
force |
bool |
— |
new
🎨 Create a new theme scaffold.
Creates a new theme with templates, partials, and assets. SLUG is t…
new
def new(slug: str, mode: str, output: str, extends: str, force: bool) -> None
🎨 Create a new theme scaffold.
Creates a new theme with templates, partials, and assets. SLUG is the theme identifier used in config (e.g., [site].theme = SLUG).
Parameters 5
| Name | Type | Default | Description |
|---|---|---|---|
slug |
str |
— | |
mode |
str |
— | |
output |
str |
— | |
extends |
str |
— | |
force |
bool |
— |