Keeps a site's Typekit in
localStorage and injects it on page load.
Eliminates the annoying Flash Of Invisible/Unstyled Text (FOUT) and provides
better UX for slow or offline connections.
Copy the contents of typekit-cache.min.js right before your Typekit (advanced) embed code. That's it, your website should be caching your Typekit happily.
The regular Typekit behavior is not modified at all.
Exceptions visible in the console (e.g. if the storage is not available) can be safely ignored.
However, you should use separate
<script> tags to ensure the Typekit embed code is still run if an exception occurs.
In addition to the regular
wf-* classes, the
wf-cached class is added to the
<html> tag on cache hit.
sessionStorage instead, just replace the
Make sure PRs contain an updated minified version.
npm run prepublish to build it.