Theme-agnostic DocsSite stack; one-line EE branding - #27
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
DocsSite.standardLayershardcodedTheme.defaultamong nine layers, so any branded consumer had to re-list the entireZLayer.makeblock. 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 viaZLayer.makeSome, withThemeleft as an environment hole. Nothing in the stack providesTheme(it is consumed byPageTemplate.live,LandingTemplate.liveandSiteBuilder.Env), so this is a holestandardLayersmerely happened to plug.DocsSite.standardLayers = Theme.default >>> themedStack— unchanged meaning for existing callers.EarlyEffectTheme.layers— pre-composed branded stack.EarlyEffectTheme.brand(site)— setslogo/logoLink, usingorElseso an explicit value still wins.BuildSiteand the prose in README / Concepts / LibraryAuthors updated to the new three-one-liner shape.Consumers become:
Verification
sbt testFullgreen; two new tests cover the split —standardLayersstill emits stockThemeTokens.defaultCSS with noprefers-color-schemeblock, andthemedStackpicks up a caller-supplied theme instead.sbt scalafmtCheckAllgreen.diff -rqshows onlyconcepts.html,library-authors.htmlandassets/client.jsdiffer, all from the prose edits.assets/theme.css,index.htmlandmetadata.jsonare byte-identical.