STD-DRUPAL-002: Drupal Composition & Theme Governance Doctrine¶
Status: Approved Governing Standard
Authority: Thomas P. Scola Jr. — Drupal Architecture Direction
Date: 2026-09-23
Bead: bc-um0w / bc-opt2
1. Prime Directive: Sites are Consumers, Not Implementation Grounds¶
Consumer Drupal sites (bluefly.io, contextcontrol-ai, etc.) must be assembled via composition, not bespoke custom code or bloated custom themes.
UPSTREAM DRUPAL CMS + CONTRIB + CANVAS + SDC + RECIPES + SITE TEMPLATES + MINIMAL THEME
Invariants:¶
DRUPAL_SITES_ARE_CONSUMERS = YESBUILD_WITH_CONFIGURATION = YESUPSTREAM_FIRST = YESCONTRIB_FIRST = YESRECIPES_BEFORE_CUSTOM_SETUP = YESCANVAS_SDC_BEFORE_TWIG_OVERRIDES = YESCUSTOM_CODE_LAST = YESEDIT_ACTIVE_WEB_FOLDER = NOGAS_CITY_WORKTREE_ONLY = YESIS_THE_NEXT_RUN_GETTING_CHEAPER_AND_MORE_REUSABLE = YES(Acceptance gate)
2. Re-architecting Theme vs. Composition Boundaries¶
Custom sub-themes (bluefly_theme) MUST be strictly reduced to a thin branding shell.
Legitimate Theme Responsibilities:¶
- Design tokens / CSS custom properties overrides.
- Brand assets (logos, favicons).
- Truly site-unique presentation adjustments that cannot be achieved via SDC/Canvas.
Prohibited in Theme (Must be Moved to Upstream/Composition):¶
- Page layout logic (belongs in Canvas / Site Templates).
- Content type templates / Twig overrides (belongs in Canvas Content Templates / Entity View Displays).
- Generic components (belongs in Core SDCs or contrib SDC libraries).
- Duplicated design system compilation (must consume compiled packages from
agentic_canvasor@bluefly/studio-ui). - Content modeling & business rules (belongs in Drupal Recipes / Config).
3. Site Templates & Canvas Authority¶
- Drupal CMS Site Templates: Site functionality and page patterns should be defined as recipes and exported via
drush site:exportinto reusable Site Templates. - Canvas CLI vs. Theme Inheritance:
- Theme inheritance passes CSS/JS libraries and base templates down the Drupal theme tree.
- Canvas CLI manages Canvas code components, pages, content templates, and global styling.
- Do not conflate theme inheritance with Canvas CLI synchronization.
4. Single-Directory Components (SDC)¶
SDC is part of Drupal Core. Reusable server-rendered components must use SDC contracts:
- component.yml (schema, props, slots)
- component.twig
- Component-scoped CSS/JS (only when necessary)
- No proliferation of global unstructured CSS.