Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function loadFontStyles() {
if (!window.localStorage) { return; }
var cssText;
if (cssText = localStorage.getItem('font-style-cache')) {
} else {
fetch('/css/fonts.css').then(function(cssText) {
localStorage.setItem('font-style-cache', cssText);
return cssText;
function injectFontCSS(cssText) {
var style = document.createElement('style');
style.type = 'text/css';
style.styleSheet.cssText = cssText;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.