Problem
Most FastAPI + JinjaX projects already initialise a Catalog instance at startup — often shared with Jinja2Templates so that standard page templates and JinjaX components coexist in the same environment with custom filters, globals, and extensions already registered:
# consts.py (typical project setup)
templates = Jinja2Templates(directory="templates")
templates.env.add_extension(JinjaX)
catalog = Catalog(jinja_env=templates.env)
catalog.add_folder("templates/components")
catalog.jinja_env.globals["url_for"] = ...
The README example creates a fresh Catalog in isolation:
catalog = Catalog()
catalog.add_folder(templates_dir)
renderer = JinjaxRenderer(catalog)
Component.renderer = renderer
This silently misses all existing filters, globals, and extensions — component templates render incorrectly (missing url_for, custom filters, etc.).
Request
Add a section to the README / docs explaining:
- Pass your existing catalog directly:
Component.renderer = JinjaxRenderer(existing_catalog)
- Why creating a new catalog loses context (different
jinja_env)
- If using
Jinja2Templates, show the pattern for sharing the env
What works
# In consts.py — after existing catalog setup:
from component_framework.adapters.jinjax_renderer import JinjaxRenderer
from component_framework.core.component import Component
Component.renderer = JinjaxRenderer(catalog) # ← share the existing catalog
This gives component templates full access to all custom filters and globals.
Problem
Most FastAPI + JinjaX projects already initialise a
Cataloginstance at startup — often shared withJinja2Templatesso that standard page templates and JinjaX components coexist in the same environment with custom filters, globals, and extensions already registered:The README example creates a fresh
Catalogin isolation:This silently misses all existing filters, globals, and extensions — component templates render incorrectly (missing
url_for, custom filters, etc.).Request
Add a section to the README / docs explaining:
Component.renderer = JinjaxRenderer(existing_catalog)jinja_env)Jinja2Templates, show the pattern for sharing the envWhat works
This gives component templates full access to all custom filters and globals.