Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Keeps a site's Typekit in localStorage and injects it on page load, completely eliminating Flash Of Invisible/Unstyled Text.

License

Notifications You must be signed in to change notification settings

Buyapowa/typekit-cache

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Typekit Cache

Keeps a site's Typekit in localStorage and injects it on page load. Completely eliminates the annoying Flash Of Invisible/Unstyled Text and provides better UX for slow or offline connections.

The same requests are sent as in loading a Typekit regularly, and the Typekit embed code is unaltered. However, using this script may still violate the Typekit Terms Of Use.

Usage

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.

<script>
	!function(e,t,n,a,r,s,l,p){ // ...
</script>
<script>
	(function(d) {
		var config = {
			kitId: 'abcd1234',
			scriptTimeout: 3000
		},
		h=d.documentElement, // ...
	})(document);
</script>

Notes

Works in recent Firefox, Chrome, Safari, and IE. Please contribute issues and PRs if you find any quirks. Check the unminified, commented typekit-cache.js for more information.

Typekits may be quite large, and the performance impact of injecting them as inline stylesheets is not well tested.

The minified version is built using uglifyjs typekit-cache.js -o typekit-cache.min.js --compress --mangle.

Contributors

Thanks!

About

Keeps a site's Typekit in localStorage and injects it on page load, completely eliminating Flash Of Invisible/Unstyled Text.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%