Skip to content

Instantly share code, notes, and snippets.

@clemgrim
Created December 29, 2015 15:21
Show Gist options
  • Save clemgrim/e5444000b84632260dbe to your computer and use it in GitHub Desktop.
Save clemgrim/e5444000b84632260dbe to your computer and use it in GitHub Desktop.
WebFontConfig = {google: {families: []}};
(function(d, fonts) {
WebFontConfig.google.families = fonts.map(function(font) {return font + '::latin'});
var wf = d.createElement('script');
wf.src = '//ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.async = 'true';
wf.onerror = function() {
var link;
fonts.forEach(function(font) {
link = d.createElement('link');
link.rel = 'stylesheet';
link.href = '/fonts/' + font + '/font.css';
d.head.appendChild(link);
});
};
var s = d.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})(document, ['Roboto', 'Lobster', 'Crushed']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment