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

Allow hidden CSS src in tabbed examples #989

Merged
merged 2 commits into from
Jan 19, 2023

Conversation

NiedziolkaMichal
Copy link
Member

@NiedziolkaMichal NiedziolkaMichal commented Nov 20, 2022

Currently when we want to add new font to single HTML interactive example, following steps must be taken:

  1. Add font to live-examples/fonts directory in interactive-examples repo
  2. Add the same font to live-examples/fonts directory in BOB repo
  3. Add @font-face to shadow-fonts.css in BOB repo

This PR is meant to simplify this process, but allowing custom fonts to live only in interactive-examples repo and assign them to individual examples without showing @font-face to the user. It does that by introducing cssHiddenSrc property in meta.json in tabbed examples. Now process of adding new font will look like this:

  1. Add font to live-examples/fonts directory
  2. Add CSS file with @font-face anywhere in interactive-examples repo, but preferably near font
  3. Add cssHiddenSrc property to meta.json of an example, containing path to CSS.

Another benefit of this solution, is that @font-face will be added only to examples that actually use them, while now shadow-fonts.css has to be downloaded for every example.

If this gets merged, I will add CSS files with individual fonts to interactive-examples repo, so shadow-fonts.css can be completely removed from here, along with the fonts.

Fixes #822

Copy link
Collaborator

@queengooborg queengooborg left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@queengooborg queengooborg merged commit 50a2473 into mdn:main Jan 19, 2023
@NiedziolkaMichal
Copy link
Member Author

Great, thanks!

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.

Add some web fonts we can use in examples
2 participants