Skip to content

feat(fonts): granular preload #13826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

florian-lefebvre
Copy link
Member

@florian-lefebvre florian-lefebvre commented May 20, 2025

---
import { Font } from 'astro:assets'
---

<Font cssVariable='--font-test' preload={[{ weight: 400 }]} />

Preview release

npm i https://pkg.pr.new/astro@13826

Changes

  • Requested on the Stage 3 RFC
  • Until now you only had the ability to preload all or nothing for a given family
  • With this PR, it's now possible to filter based on weight and optionally style

Testing

  • Added unit test for renderFontWeight
  • Updated the orchestrate unit tests to verify we collect the weight/style preload data
  • Tested manually
  • Updated the fixture test to check filtering works

Docs

  • Changeset
  • Docs: TODO, waiting for feedback on naming first and data
  • RFC: TODO, waiting for feedback on naming first and data

@florian-lefebvre florian-lefebvre self-assigned this May 20, 2025
Copy link

changeset-bot bot commented May 20, 2025

🦋 Changeset detected

Latest commit: 5e01c12

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label May 20, 2025
Copy link

codspeed-hq bot commented May 20, 2025

CodSpeed Performance Report

Merging #13826 will not alter performance

Comparing feat/fonts-granular-preload (5e01c12) with main (866285a)

Summary

✅ 6 untouched benchmarks

@florian-lefebvre florian-lefebvre added the pr preview This PR has a preview release label May 20, 2025
@github-actions github-actions bot removed the pr preview This PR has a preview release label May 20, 2025
Copy link

pkg-pr-new bot commented May 20, 2025

astro

npm i https://pkg.pr.new/astro@13826

@astrojs/cloudflare

npm i https://pkg.pr.new/@astrojs/cloudflare@13826

@astrojs/netlify

npm i https://pkg.pr.new/@astrojs/netlify@13826

@astrojs/node

npm i https://pkg.pr.new/@astrojs/node@13826

@astrojs/vercel

npm i https://pkg.pr.new/@astrojs/vercel@13826

commit: 5e01c12

@jonasgeiler
Copy link

Seems to be working perfectly for me! Thanks a lot for working on this! :shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants