Skip to content

Conversation

@florian-lefebvre
Copy link
Member

@florian-lefebvre florian-lefebvre commented Mar 5, 2025

Changes

  • Adds css variables generations
  • Fixes a bug around fallbacks that impacted css variables
  • RFC has been updated to remove the cssVar prop from the Font component as I'll go with another solution (upcoming PR)

Testing

Adds unit tests

Docs

N/A

@florian-lefebvre florian-lefebvre self-assigned this Mar 5, 2025
@changeset-bot
Copy link

changeset-bot bot commented Mar 5, 2025

⚠️ No Changeset found

Latest commit: 6e29005

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Mar 5, 2025
@florian-lefebvre florian-lefebvre marked this pull request as ready for review March 5, 2025 13:50
assert.equal(
resolvedMap
.get('Roboto')
.css.includes(':root { --astro-font-Roboto: Roboto, "Roboto fallback: Arial", sans-serif; }'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should --astro-font-Roboto be --astro-font-roboto?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it's correct in this case because it'm not using kebab in the test, i'm passing the name through

assert.equal(Array.from(hashToUrlMap.keys()).length > 0, true);
assert.deepStrictEqual(Array.from(resolvedMap.keys()), ['Roboto']);
assert.deepStrictEqual(logs, ['Fonts initialized']);
assert.equal(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: if you manage to use assert.match, use that because it shows the string to evaluate in case there's an error

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to look into this thanks!

@florian-lefebvre florian-lefebvre merged commit 75b1f5b into feat/fonts Mar 5, 2025
14 checks passed
@florian-lefebvre florian-lefebvre deleted the feat/fonts-css-vars branch March 5, 2025 14:30
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