Centralize shared stylesheets used by hero_website_lib #4
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_web_template#4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Meeting feedback: common styling is duplicated across hero_website_framework and various service UIs. Move shared CSS / theme tokens / Bootstrap overrides into
hero_web_templateso every Hero UI (framework-backed or not) references the same source.Scope
hero_website_framework/crates/hero_website_lib/static/css/(Bootstrap, FontAwesome, CodeMirror themes, highlight.js themes, custom admin/auth/blog CSS).hero_web_template/webcomponent/(or a new shared CSS asset crate — propose the layout in a comment).hero_website_libreferences the shared CSS instead of carrying its own copy.Out of scope
Acceptance
hero_web_template.hero_website_libpulls it at build (viarust-embedfrom a shared crate, or via a build-time copy step — propose in a comment).hero_website_libcan still include the same shared CSS with a documented snippet.Related
hero_rpc scaffold) #54Parent / context tracker: hero_skills#262 — read it before starting work on this issue. Locked decisions, reference materials, and execution order live there. Iterate via comments here; consolidation passes on the body only after feedback settles.
Audit summary
Pulled
developmentonhero_web_templateandhero_website_framework. Mapped the CSS surface on both framework crates plus the canonical theme used bydemo_website/ inline blocks in templates.What's in each crate today
hero_website_framework/crates/hero_admin_lib/static/css/— admin-side, all vendor:bootstrap.min.css,bootstrap-icons.min.css,fonts/bootstrap-icons.woff[2]highlight-github-dark.min.cssunpoly.min.cssNo Hero theme CSS file exists in
hero_admin_lib— the five hoisted Web Components (<hero-api-docs>,<hero-connection-status>,<hero-logs-viewer>,<hero-jobs-viewer>,<hero-markdown-viewer>) are self-contained Shadow-DOM and carry their own styles inline. Confirmed incrates/hero_admin_lib/src/assets.rs.hero_website_framework/crates/hero_website_lib/static/css/— website-side, mostly vendor with one Hero file:bootstrap.min.css+.mapcodemirror/*.min.css(8 files: core + 3 themes + fold/show-hint/fullscreen)fontawesome/*.min.css(5 files) +static/webfonts/fa-*highlight/*.min.css(4 themes)blog-content.css(96 lines, scoped to.blog-content)Hero-specific theming actually lives inline in templates, not in
.cssfiles. The canonical block iscrates/hero_website_lib/default_templates/admin/base.html:22–827(805 lines) — and matches the meeting brief almost word-for-word (--primary/dark-mode--dm-*tokens,.admin-tabs,.stat-box{.success,.info,.warning,.danger,.error},.admin-card, table/form/button/badge/alert overrides,[data-theme="dark"]cascade,.log-row-error/.log-row-warn,.theme-toggle, dark scrollbar, transition rules). Other inline<style>blocks of note:admin/login.html(286 lines),admin/blog_edit.html(136),auth/visitor_register.html(88) — these are page-specific and out of scope unless we choose to also extract them.Three Hero admin themes exist in the wild — open question
I want to flag this before moving anything: there are three distinct Hero admin theme systems today, and they use different token namespaces / dark-mode conventions:
hero_website_lib/default_templates/admin/base.html(inline)--primary,--success,--dm-bg,--dm-surface,--dm-card,--dm-text, ...[data-theme="dark"](custom attr)hero_proc/crates/hero_proc_admin/static/css/dashboard.css--bg-primary,--bg-secondary,--accent-green/blue/..., derived from--bs-*[data-bs-theme="dark"](Bootstrap-native)hero_web_template/webcomponent/templates/base.html(inline)--bg-darker,--bg-card,--accent-teal,--text-primary/secondary[data-bs-theme="dark"](Bootstrap-native)The issue body's vocabulary ("admin tab styling, stat-boxes, dark/light tokens") maps exactly to the
hero_website_lib/admin/base.htmlblock — so I'm treating that one as the canonical source for this refactor. Confirm if you'd rather we pick thehero_proc_admin/ Bootstrap-native variant ([data-bs-theme]is more aligned with Bootstrap 5.3 and would future-proof us against Bootstrap upgrades). I'd default to keeping thehero_website_libtokens (matches issue scope, both framework crates already render with it) and file a separate follow-up issue to unify withhero_proc_admin's convention as a design pass — not part of this refactor.Proposed asset layout
A new top-level directory at
hero_web_template/theme/, exposed as a small Rust crate namedhero_theme:Why a sub-crate, not a flat
static/dir:hero_admin_libandhero_website_libalready userust-embedto bake their assets into the binary. A sibling crate that also exposes a#[derive(Embed)]struct lets them re-export the same assets with zero new mechanism. No build-step copy, no path-juggling, deterministic in CI.hero_theme = { git = "...", branch = "development" }and mount it the same way.Why split into four CSS files instead of one bundle:
hero-tokens.cssalone is what a service usually wants if it has its own admin shell — let people opt into just the design tokens.hero-admin.cssis the "give me the standard admin dashboard look" file. Pulls inhero-tokens.css.hero-forms.css/hero-content.cssare nice-to-haves that polish Bootstrap form controls and code blocks.<link>tags or onehero-all.cssaggregator — happy to do either. Five named files reads better for the docs snippet.Inclusion mechanism
Framework crates (
hero_admin_lib,hero_website_lib):In
Cargo.toml:In the admin router (one line):
In the consumer's
base.html(replaces the 805-line inline block):hero_website_lib's defaultadmin/base.htmlis the first consumer — its inline<style>block is deleted and replaced with the four<link>tags above.Non-framework service (documented snippet, README.md):
Option A — Cargo dep (preferred, version-locked):
…then add the four
<link>tags inbase.html.Option B — raw
<link>to the forge raw URL (zero Cargo touch, no version lock):Open questions before I move files
hero_website_lib/admin/base.htmltokens ([data-theme="dark"], gradient navbar) for this refactor, and file a separate unify-with-hero_proc_adminissue later? Or pick the Bootstrap-native[data-bs-theme]convention now, which means rewriting the dark-mode cascade?hero_web_template/theme/(sibling ofwebcomponent/andbackend/— what I'm proposing) vshero_web_template/crates/hero_theme/(workspace-style)? The repo isn't a Cargo workspace today; either works, sibling is simpler.hero_web_templateis also the clone-me starter. Oncetheme/lives here, anyone cloning the repo to start a service gets both. Acceptable? Or shouldtheme/be a separatehero_web_themerepo andhero_web_templatejust depend on it? (I'd default to keeping it here — fewer repos to wire, and the META locked decision says "Shared CSS / theme tokens live inhero_web_template".)blog-content.css— also move intotheme/static/css/, or leave it inhero_website_libsince only the blog feature uses it? I'd move it; "one place for shared theme CSS" reads cleaner.<style>blocks fromadmin/login.html/admin/blog_edit.html/auth/visitor_register.html/ theadmin/docs/*.htmlfiles? They're small (88–286 lines), page-specific, and not in the issue's scope vocabulary, so I'd leave them inline.Once you confirm #1 and #2 (the rest I can default if you don't have a preference) I'll do the move + framework reference updates in one commit, push to a feature branch, and open a PR per
hero_branching.