Skip to content

Conversation

@florian-lefebvre
Copy link
Member

@florian-lefebvre florian-lefebvre commented Apr 23, 2025

Changes

  • RFC feedback
  • People migrating to the fonts API with local fonts tend to leave their fonts in public, but this is not recommended as we copy fonts so files are effectively duplicated in the build output

Testing

Manual

Docs

withastro/docs#11511 + changeset

@florian-lefebvre florian-lefebvre self-assigned this Apr 23, 2025
@changeset-bot
Copy link

changeset-bot bot commented Apr 23, 2025

🦋 Changeset detected

Latest commit: c06f9bd

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 Apr 23, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Apr 23, 2025

CodSpeed Performance Report

Merging #13678 will not alter performance

Comparing feat/fonts-warn-public-dir (c06f9bd) with main (42388b2)

Summary

✅ 6 untouched benchmarks

Copy link
Member

@ArmandPhilippot ArmandPhilippot left a comment

Choose a reason for hiding this comment

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

Docs review (but you probably want the opinion of a native speaker 😄 ): the warning looks fine to me! I only left a nit regarding the changeset. So, LGTM.

Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

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

So, I left a comment about the warning itself, but I have a question about having this warning in the first place.

So, with this warning, someone with a font file in public/ will see this EVERY time? Why would someone choose to keep it in public, and if there is a good reason and they're intentionally doing this, they probably don't want to see a warning every time? Just making sure that this won't affect someone this way.

I can see in the docs PR we're suggesting not to do this, so presumably it's OK if the warning suggestions people should move their file. But just want to make sure there's not a good reason for not doing so, and whether people are signing up for this error when maybe just having docs is enough?

@JusticeMatthew
Copy link
Contributor

So, with this warning, someone with a font file in public/ will see this EVERY time? Why would someone choose to keep it in public, and if there is a good reason and they're intentionally doing this, they probably don't want to see a warning every time? Just making sure that this won't affect someone this way.

I can't think of a use case where keeping fonts in public would be better, after having spent many hours optimizing fonts in my own projects

This warning does seem like a good thing to have for the very specific users that Florian mentions who have perhaps forgotten to move/delete the fonts from public after upgrading to the new API

@florian-lefebvre
Copy link
Member Author

So, with this warning, someone with a font file in public/ will see this EVERY time?

Only when using the experimental fonts API

Why would someone choose to keep it in public

I don't think there's any good reason to do so when using this feature

@ematipico
Copy link
Member

As for now, the warning is fine because it's an experimental feature, however I don't think we should keep it once it's out of experimental.

We don't warn users if they have their images in public/, so we shouldn't for fonts too.

It's up to the users to decide what to do, as long as docs warn them.

@florian-lefebvre
Copy link
Member Author

Good point, i'll add a todo comment

Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

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

I agree with Ema that when stable, this doesn't feel like a necessary warning but instead something to document. But the message as written is fine by me!

@florian-lefebvre florian-lefebvre merged commit 2e528cb into main Apr 24, 2025
16 checks passed
@florian-lefebvre florian-lefebvre deleted the feat/fonts-warn-public-dir branch April 24, 2025 13:25
@astrobot-houston astrobot-houston mentioned this pull request Apr 23, 2025
openscript pushed a commit to openscript/astro that referenced this pull request Sep 12, 2025
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.

5 participants