Skip to content

feat: embed Font Awesome icons at build time, drop kit stylesheet#414

Open
byte-the-bot wants to merge 4 commits into
mainfrom
byte/font-awesome-embed
Open

feat: embed Font Awesome icons at build time, drop kit stylesheet#414
byte-the-bot wants to merge 4 commits into
mainfrom
byte/font-awesome-embed

Conversation

@byte-the-bot

Copy link
Copy Markdown
Collaborator

First consumer of font-awesome-embed 🎉

  • All 13 icon usages (footer socials, podcast subscribe buttons, project GitHub links) switch from webfont <i class> tags to compile-time embedded SVGs via fa!()
  • The render-blocking kit.fontawesome.com stylesheet is gone — one less third-party request on every page, and icons render immediately with no font-loading flash
  • .fa-cache/ is committed (wired via .cargo/config.toml FA_CACHE_DIR), so CI, Docker, and Fly review apps build with no token and no network — no workflow changes needed. All cached icons are Free-tier (CC BY 4.0; attribution lives on /legal)
  • Adding a new icon: have FONT_AWESOME_TOKEN set locally (the new .mise.toml pulls it from 1Password via mull secrets), build once, commit the new cache file
  • /legal colophon updated — icons are no longer loaded via CSS link
  • Small .fa-svg CSS rule keeps the SVGs inline (Tailwind preflight makes svg block-level)

Verified locally: build with token populates the cache, tokenless build + clippy pass from cache alone, cargo-deny bans clean. A Fly review app should spin up on this PR for visual checking — footer socials, /podcast buttons, and any project page are the spots to eyeball.

🤖 Generated with Claude Code

Replaces the webfont <i class> icons and the render-blocking
kit.fontawesome.com stylesheet with compile-time embedded SVGs via
font-awesome-embed. Icons inherit text color and size, and the committed
.fa-cache/ means CI and Fly builds need no Font Awesome token or network
— the token (via .mise.toml + 1Password) is only needed locally when
adding a new icon.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Not redistributing Font Awesome SVGs is a design goal of font-awesome-embed,
so the committed .fa-cache/ is gone. Instead FONT_AWESOME_TOKEN (Actions
secret) feeds the Rust Tests workflow, and Fly deploys pass it as a Docker
build secret. The review-app workflow drives flyctl directly since
fly-pr-review-apps can't pass build secrets.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@byte-the-bot

Copy link
Copy Markdown
Collaborator Author

Reworked per Corey's direction: no committed icon cache (avoiding redistribution of FA SVGs is a design goal of the crate). Instead:

  • FONT_AWESOME_TOKEN Actions secret (already set on this repo) feeds the Rust Tests workflow
  • fly_deploy.yml passes it as a Docker build secret (--build-secret + BuildKit mount in the Dockerfile)
  • The review-app workflow now drives flyctl directly — superfly/fly-pr-review-apps can't pass build secrets
  • Also made coreyja-studio/font-awesome-embed public so cargo can fetch the git dependency in CI (it's pure macro code, no FA assets — flag if you'd rather keep it private and auth the fetch instead)

The Lint job hit FA's rate limit (HTTP 429) because each fa!() expansion
did its own token exchange across three parallel jobs. The crate now
caches the access token per process and retries transient failures, and
FA_CACHE_DIR under target/ lets Swatinem/rust-cache persist fetched
icons across CI runs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Pre-existing lint newly enforced by stable clippy; unrelated to icons but
fails this PR's Lint job.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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