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

Stop embedding the Inter font and publish CommonJS packages again #48

Merged
merged 3 commits into from
Aug 2, 2023

Conversation

sandhose
Copy link
Member

@sandhose sandhose commented Aug 1, 2023

This stops the embedding of the inter font and instead rely on the @fontsource/inter package.

This means that consumers need to install the package and import the font themselves.
It is set as peer dependency, so it will warn if the consumer does not have it installed.

It also means we can switch back to library mode, and emit commonjs builds alongside esm builds.

For consumers, the change is instead of importing just @vector-im/compound-web/dist/index.css, they need to:

@import url("@fontsource/inter/400.css");
@import url("@fontsource/inter/500.css");
@import url("@fontsource/inter/600.css");
@import url("@fontsource/inter/700.css");
@import url("@vector-im/compound-design-tokens/assets/web/css/compound-design-tokens.css");
@import url("@vector-im/compound-web/dist/style.css");

@sandhose sandhose requested a review from a team as a code owner August 1, 2023 16:50
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Aug 1, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: a64e9e2
Status: ✅  Deploy successful!
Preview URL: https://87107887.compound-web.pages.dev
Branch Preview URL: https://quenting-extract-inter-font.compound-web.pages.dev

View logs

@sandhose sandhose changed the title Do not embed the Inter font and except consumers to load them themselves. Stop embedding the Inter font and publish CommonJS packages again Aug 1, 2023
:root {
/* This is a false positive */
/* stylelint-disable unit-no-unknown */
--cpd-inter-unicode-range: U+0000-20e2, U+20e4-23ce, U+23d0-24c1, U+24c3-259f,
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 just don't know about that. I know the @font-face in @fontsource/inter has some unicode ranges, but I don't know if it properly excludes the emojis or not. Do we have a way to test that?

Copy link
Contributor

Choose a reason for hiding this comment

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

So i've actually removed global.css from the exported CSS.
It's still used in Storybook, but right now it is not a great idea to have all of that.

This bit is particularly critical for Element Web, but a bit less for other projects. We do have visual regression tests for it on Percy yes. But only for EW.

Copy link
Contributor

@germain-gg germain-gg left a comment

Choose a reason for hiding this comment

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

Makes sense, looks good to me!

package.json Outdated Show resolved Hide resolved
@germain-gg germain-gg merged commit c19a2ac into main Aug 2, 2023
7 checks passed
@germain-gg germain-gg deleted the quenting/extract-inter-font branch August 2, 2023 08:14
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