Skip to content
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

Font isn't loading on production #100

Closed
reefdog opened this issue Sep 17, 2024 · 4 comments · Fixed by #108
Closed

Font isn't loading on production #100

reefdog opened this issue Sep 17, 2024 · 4 comments · Fixed by #108
Assignees

Comments

@reefdog
Copy link
Collaborator

reefdog commented Sep 17, 2024

In production, the font is trying (and failing) to load from the path https://arches-app-demo.opentechstrategies.com/assets/inter-latin-wght-normal-[signature].woff2. But other static assets are coming from https://arches-app-demo.opentechstrategies.com/static/archesdataviewer/vite_build/assets/*.

I suspect there is some build-fu — or perhaps Fontsource-configuration — that we need to do to make sure the font is correctly referenced.

@reefdog
Copy link
Collaborator Author

reefdog commented Sep 17, 2024

The fonts are being correctly built to the target directory: https://github.com/OpenTechStrategies/arches-app-exp/tree/main/archesdataviewer/static/vite_build/assets

But Fontsource isn't aware of that location, I guess?

@hminsky2002
Copy link
Collaborator

@reefdog this has been plaguing me since we introduced the font. Because of nginx config defined here, we are serving everything from the archesdataviewer/static directory from static/archesdataviewer. For reference, navigating to https://arches-app-demo.opentechstrategies.com/static/archesdataviewer/vite_build/assets/inter-latin-wght-normal-C2S99t-D.woff2 will indeed download you the fonts. Is there any way to customize the font-source url that it seeks the font from?

@hminsky2002 hminsky2002 self-assigned this Sep 17, 2024
@reefdog
Copy link
Collaborator Author

reefdog commented Sep 18, 2024

@hminsky2002 Oh, I missed your reply here somehow.

Is there any way to customize the font-source url that it seeks the font from?

This is what I'm hoping to find! There's not any word of that in the (sparse) documentation, but I hold out hope for that. Before we commit to the CDN route — the site's not broken without it, it just looks a bit plainer — I'm going to explore this a little more, ping the devs, etc.

@reefdog
Copy link
Collaborator Author

reefdog commented Sep 24, 2024

Okay, so: I'm going to solve this the coward's way, also known as the way I probably should have explored in the beginning: re-evaulating whether we even want a custom font at all! Behold…

Using the Inter font… font-stack-1-inter
Using the system-default font stack (used by GitHub, et al)… font-stack-1-default

There are miniscule ways in which I prefer Inter, but not nearly enough to justify the trouble -- or even the additional network weight. I'm going to just remove the custom font entirely.

reefdog added a commit that referenced this issue Sep 24, 2024
After struggling to get a Fontsource-provided font to serve correctly in
production using our Vite build process, I decided to re-evaluate our
need to even use a custom font. Turns out it wasn’t doing us enough good
to justify either the development time struggling with this *or* the
user experience cost with custom fonts.

- Switch from Inter to the GitHub/Bootstrap-style native font stack
- Remove Fontsource package

Issue #100 Font isn't loading on production
reefdog added a commit that referenced this issue Sep 24, 2024
After struggling to get a Fontsource-provided font to serve correctly in
production using our Vite build process, I decided to re-evaluate our
need to even use a custom font. Turns out it wasn’t doing us enough good
to justify either the development time struggling with this *or* the
user experience cost with custom fonts.

- Switch from Inter to the GitHub/Bootstrap-style native font stack
- Remove Fontsource package

Issue #100 Font isn't loading on production
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 a pull request may close this issue.

2 participants