contentful / forma-36

A design system by Contentful
https://f36.contentful.com
MIT License
335 stars 81 forks source link

feat: add CDN #2871

Closed andipaetzold closed 1 month ago

andipaetzold commented 2 months ago

Creating a CDN for Forma using Fastly Compute to host the Geist font: https://vercel.com/font.

Adds a GH action that auto-deploys the CDN when merging to main.

The files will be deployed as https://cdn.f36.contentful.com/*. You can try an example deploy with an older font version: https://cdn.f36.contentful.com/fonts/geist-sans-1.3.0.woff2

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
forma-36 ✅ Ready (Inspect) Visit Preview Oct 23, 2024 11:13am
changeset-bot[bot] commented 2 months ago

⚠️ No Changeset found

Latest commit: 426619af3b91dd0b2c60bf04a13844bf0427bb10

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

github-actions[bot] commented 2 months ago

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
CommonJS 112.03 KB (0%) 2.3 s (0%) 1.8 s (+19.72% 🔺) 4 s
Module 110.84 KB (0%) 2.3 s (0%) 1.9 s (-7.73% 🔽) 4.1 s
github-actions[bot] commented 1 month ago

Marking pull request as stale since there was no activity for 30 days

denkristoffer commented 1 month ago

Just a general question but shouldn't a CDN generally be served from a different domain to avoid wasting bytes on cookies from the web app?

andipaetzold commented 1 month ago

Just a general question but shouldn't a CDN generally be served from a different domain to avoid wasting bytes on cookies from the web app?

Yes, to save every single byte, we would need to use a totally separate domain. For the Web App itself, the HTML is loaded from app.contentful.com and the static files from static.contentful.com to reduce the number of cookies. Not all cookies have strict same site policy, so they are also sent to static.contentful.com.

Fonts are only loaded once per page load (+within apps) and are not render blocking. Having a separate domain would have an insignificant performance improvement. By using a contentful.com subdomain, customers inspecting the network traffic know that the traffic goes to Contentful and not a third party service.