Skip to content

Sort the CSS files by what they are for - #50

Merged
t4k merged 1 commit into
caltechlibrary:mainfrom
t4k:cleanup/sort-css-by-purpose
Sep 2, 2026
Merged

Sort the CSS files by what they are for#50
t4k merged 1 commit into
caltechlibrary:mainfrom
t4k:cleanup/sort-css-by-purpose

Conversation

@t4k

@t4k t4k commented Sep 2, 2026

Copy link
Copy Markdown
Member

The root css/ directory held one file and gave no clue whose it was. The two
stylesheets here serve unrelated purposes, and neither belonged where it was.

code-blocks.css belongs to the shared theme

It styles pre, pre > code and .copy-button on documentation pages.
Nothing in src/ references it — .copy-button comes from
src/copyToClipboard.js, which is not a component: no customElements.define,
not exported from mod.js.

It is part of the Pandoc theme, so caltechlibrary/workflows should own it and
ship it into every site it builds, alongside the template that asks for it.
That change is in progress. This repository does not need a copy either way, so
it is deleted here.

Interim state, stated plainly: until this repository adopts the shared
template (#51), its own pandoc/page.tmpl loads the stylesheet from
/css/code-blocks.css — the copy the organization site serves at the domain
root, byte-identical to the one deleted here. That is a dependency we intend to
remove, not endorse; it replaces the current dependency on a stale S3 copy,
so it is an improvement in the meantime.

Root-relative, not relative. A template renders pages at any depth, so a
relative href is only correct if every page sits at the output root.
build-pandoc happens to emit everything flat today, which would have made a
relative href correct by accident. /css/code-blocks.css matches the assumption
the template already makes with <a href="/">All Library Apps</a>.

Note the asymmetry: copyToClipboard.js has no copy anywhere but the S3 CDN, so
it stays referenced there until the theme change lands.

textarea-agent-list.css is component CSS, and was unreachable

css-href is a documented consumer feature on textarea-agent-list and
textarea-csv — it injects a <link> into the shadow root so a consumer can
replace the component’s styling. This file is the default for the former: it
styles ul/li, exactly what the component renders.

It was published nowhere:

404  https://software.library.caltech.edu/CL-web-components/textarea-agent-list.css
404  https://media.library.caltech.edu/cl-webcomponents/textarea-agent-list.css

publish_to_s3.bash uploads root *.js and css/*.css, but not root *.css.
A documented feature had no default to point at.

It moves to src/textarea-agent-list.css, next to the component and matching
its name, and deno task build gains a copy-css step putting src/*.css into
dist/. It publishes flat, alongside the component:

…/cl-webcomponents/textarea-agent-list.js
…/cl-webcomponents/textarea-agent-list.css

docs/textarea-agent-list.md now states that URL.

Follow-on

Root css/ no longer exists, so sources: in the publish workflow drops to
dist alone. Two things briefly go stale until that branch lands:
publish_to_s3.bash:165 globs css/*.css and will match nothing, and
docs/DEPLOYMENT.md:116 describes that behaviour. Both are deleted or rewritten
by the publish change; nothing has run that script since July 2025.

The root css/ directory held one file and gave no clue whose it was. The
two stylesheets in this repository turned out to serve unrelated purposes,
and neither belonged where it was.

code-blocks.css styles pre, pre > code and .copy-button on documentation
pages. Nothing in src/ references it -- .copy-button comes from
src/copyToClipboard.js, which is not a component. But it is not this
project's file either: caltechlibrary/caltechlibrary.github.io owns it and
serves it at /css/code-blocks.css, byte-identical to the copy here, next to
site.css which the template already loads. So it is deleted rather than
moved, and the template loads the org copy with a root-relative href.
Root-relative rather than relative because a template renders pages at any
depth; build-pandoc happens to emit everything flat today, which made the
relative form correct by accident.

textarea-agent-list.css is component CSS. css-href is a documented feature
of textarea-agent-list and textarea-csv, letting a consumer replace the
component's styling, and this is the default for the former. It was
reachable by nobody: publish_to_s3.bash uploads root *.js and css/*.css but
not root *.css, so it returned 404 on both hosts. It moves to src/, beside
the component it belongs to and matching its name, and deno task build now
copies src/*.css into dist/ so it publishes with everything else.

Root css/ no longer exists, so sources: in the publish workflow can drop it
and upload dist alone.
@t4k
t4k force-pushed the cleanup/sort-css-by-purpose branch from 00b03f7 to cd88560 Compare September 2, 2026 17:49
@t4k
t4k merged commit 8c2cb3a into caltechlibrary:main Sep 2, 2026
2 checks passed
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