Skip to content

feat(website): Allow additional CSS to replace or augment CSS in generated HTML - #288

Merged
agessaman merged 4 commits into
agessaman:devfrom
hickey:feat/generate-local-css
Sep 18, 2026
Merged

agessaman merged 4 commits into
agessaman:devfrom
hickey:feat/generate-local-css

Conversation

@hickey

@hickey hickey commented Sep 17, 2026

Copy link
Copy Markdown

What this changes

This adds the ability for a CSS file to replace or augment the CSS that is in the HTML generated by generate_website.py.

Why

Provide the end user the ability to customize the the generated HTML to suite their tastes and/or integrate into an existing website better.

Testing

Tests have been added and using the output currently.

Checklist

  • Branched from dev and targeting dev
  • make test passes
  • make lint passes (ruff + mypy)
  • Frontend lint passes if templates changed (npm run lint:frontend)
  • Tests added or updated for behavior changes
  • CHANGELOG.md updated under ## [Unreleased] if user-visible
  • Config changes are reflected in config.ini.example (and the minimal/quickstart
    templates where relevant) — CI validates these with validate_config.py --strict
  • New docs pages are added to nav: in mkdocs.yml
  • Any new command justifies its airtime and defaults conservatively

Signed-off-by: Gerard Hickey <hickey@kinetic-compute.com>
Signed-off-by: Gerard Hickey <hickey@kinetic-compute.com>
@hickey
hickey force-pushed the feat/generate-local-css branch from 7cdbb6b to a03834d Compare September 17, 2026 02:17
- Emit the --link-css <link> after the built-in <style> block. It was
  placed before it, so built-in rules won every tie and a linked :root
  override had no effect.
- Drop the unreachable replace-only branches. --style always resolves to
  a built-in style, so custom CSS always layers on top of one.
- Read --embed-css in main() and exit 1 if it can't be read, before
  plugins load, instead of logging and silently falling back. The file
  contents are passed to generate_html() as custom_css.
- Allow --link-css and --embed-css together (embedded first, linked last)
  instead of silently dropping --embed-css.
- HTML-escape the --link-css href.
- Pass both options through to --sample pages.
- Restore byte-identical default output (no stray blank line in <head>).
- Rework tests: cascade order, escaping, both flags together, every style,
  main() failing on an unreadable file and wiring --sample.
- Describe the actual cascade order, how relative --link-css and
  --embed-css paths resolve, and the error on an unreadable file.
- Remove the "without --style" custom design case, which isn't possible.
- Note that --sample pages pick up custom CSS, and that --link-css pages
  need the stylesheet uploaded alongside index.html.
- Demote the CSS architecture section from a second H1 to H2.
- Mark theme variables that no base rule uses, and note where
  !important and hard-coded colors limit variable-only overrides.
- Smooth scrolling comes from CSS scroll-behavior, not JavaScript.
- Tighten the changelog entry.
@agessaman
agessaman merged commit 6686564 into agessaman:dev Sep 18, 2026
9 of 10 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.

2 participants