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

fix: storybook static directory #119

Merged
merged 1 commit into from
May 7, 2024

Conversation

huyenltnguyen
Copy link
Member

@huyenltnguyen huyenltnguyen commented May 7, 2024

Checklist:

Issue

I noticed that the Storybook site in production (https://opensource.freecodecamp.org/ui) doesn't have the correct fonts, even after #100.

Storybook does automagically pull the fonts into a static/media folder:

Screenshot 2024-05-07 at 12 16 34

But we don't look for fonts in that path:

src: url("./assets/fonts/lato/Lato-Light.woff") format("woff");

Solution

To resolve the issue, I'm adding the staticDirs option to the Storybook config, which asks Storybook to copy the files into the specified folder:

Screenshot 2024-05-07 at 12 36 11

Notice that the static/media folder is still there. This appears to be the default in Storybook, and I can't seem to find a config option to remove/omit the folder.

Reference

https://storybook.js.org/docs/configure/images-and-assets#serving-static-files-via-storybook-configuration

@huyenltnguyen huyenltnguyen marked this pull request as ready for review May 7, 2024 05:56
@huyenltnguyen huyenltnguyen requested a review from a team as a code owner May 7, 2024 05:56
Copy link
Contributor

@ojeytonwilliams ojeytonwilliams left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@huyenltnguyen huyenltnguyen merged commit 5317d85 into freeCodeCamp:main May 7, 2024
5 checks passed
@huyenltnguyen huyenltnguyen deleted the fix/storybook-fonts branch May 7, 2024 13:52
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