Skip to content

Theme-agnostic DocsSite stack; one-line EE branding - #27

Merged
russwyte merged 1 commit into
mainfrom
theme-stack-api
Jul 25, 2026
Merged

Theme-agnostic DocsSite stack; one-line EE branding#27
russwyte merged 1 commit into
mainfrom
theme-stack-api

Conversation

@russwyte

Copy link
Copy Markdown
Contributor

Why

DocsSite.standardLayers hardcoded Theme.default among nine layers, so any branded consumer had to re-list the entire ZLayer.make block. That block is copy-pasted verbatim in five sites across the org (specular, zipx, sbt-dynver-ci, ascent, the hub) — which is where doc-theme drift actually comes from.

What

  • DocsSite.themedStack: ZLayer[Theme, Nothing, SiteBuilder] — the same stack via ZLayer.makeSome, with Theme left as an environment hole. Nothing in the stack provides Theme (it is consumed by PageTemplate.live, LandingTemplate.live and SiteBuilder.Env), so this is a hole standardLayers merely happened to plug.
  • DocsSite.standardLayers = Theme.default >>> themedStack — unchanged meaning for existing callers.
  • EarlyEffectTheme.layers — pre-composed branded stack.
  • EarlyEffectTheme.brand(site) — sets logo / logoLink, using orElse so an explicit value still wins.
  • Dogfood BuildSite and the prose in README / Concepts / LibraryAuthors updated to the new three-one-liner shape.

Consumers become:

override def site   = EarlyEffectTheme.brand(super.site)
override def layers = EarlyEffectTheme.layers
override def afterBuild(out: Path, result: SiteOutput) = EarlyEffectTheme.writeLogo(out)

Verification

  • sbt testFull green; two new tests cover the split — standardLayers still emits stock ThemeTokens.default CSS with no prefers-color-scheme block, and themedStack picks up a caller-supplied theme instead.
  • sbt scalafmtCheckAll green.
  • Built the dogfood site before and after: diff -rq shows only concepts.html, library-authors.html and assets/client.js differ, all from the prose edits. assets/theme.css, index.html and metadata.json are byte-identical.

DocsSite.standardLayers hardcoded Theme.default among nine layers, so any
branded consumer had to re-list the whole ZLayer.make block. That block is
copy-pasted verbatim in five sites across the org.

Split it: themedStack is the same stack with Theme left as an environment
hole (ZLayer.makeSome), and standardLayers is Theme.default >>> themedStack,
so its meaning is unchanged for existing callers.

early-effect-docs-theme now pre-composes the branded stack as
EarlyEffectTheme.layers and adds EarlyEffectTheme.brand(site) for the header
logo + hub link (only filling fields the caller left unset). Branding a site
is three one-liners instead of a nine-layer copy-paste.

Rendered output is byte-identical apart from the two prose pages whose text
changed.
@russwyte
russwyte merged commit 86878b6 into main Jul 25, 2026
6 checks passed
@russwyte
russwyte deleted the theme-stack-api branch July 25, 2026 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant