Follow

So, using rawgit.com and a dedicated 'cdn' repo on github, I can now refer to the Charis with 1 year browser cache times and utilize it from a CSS/HTML generator with just two lines of :

@import url('cdn.rawgit.com/tim-janik/cdn/a');

html { font-family: "CharisSILW", serif; }

No costs involved and no user tracking by fonts.google either ;-)

It turns out that rawgit.com/ is about to shutdown (being just a hobby project after all), but jsDelivr stepped up to provide the same functionality now.

So the previously posted snippet for using the CharisSIL5 webfont now becomes:

@import url('cdn.jsdelivr.net/gh/tim-janik/');

html { font-family: "CharisSILW", serif; }

The behind jsDelivr is cloudflare and the content is served with a Cache-Control max-age of 365 days.

Show thread

@timj Why not just use a file in your normal website repo as the source for the rawgit CDN?

And then can you have fallbacks? I guess you could name the font "charis-cdn", "charis-fallback", depending on location and then refer to both fonts in the font stack.

(Fallback can be local to your website, for example.)

I wonder if the fallback idea would work without the browser trying to download both copies?

@timj Really interesting; I'm going to have to try this out too.

@garrett I'm not hosting a website that uses Charis directly. I'm working on a docu generator that *others* can use, it might for instance call asciidoctor.

So I need a link that works for content hosted by others, e.g. like cdnjs.cloudflare/.../font-awesome.css on that asciidoctor by default refers to.

@timj OK! Yeah, that makes a lot of sense to have a "CDN" repo in that case. Neat!

Sign in to participate in the conversation
Mastodon

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!