nire0510
11/26/2015 - 11:02 AM

Dynamically download and serve web-fonts from Google's repo for better performance

Dynamically download and serve web-fonts from Google's repo for better performance

(function (window) {
  'use strict';

  // Global configuration for web-font:
  window.WebFontConfig = {
    google: {
      families: [ 'Oxygen:700,400:latin' ]
    },
    timeout: 2000
  };

  // Create & inject Google's web font loader:
  var wf = document.createElement("script");
  wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
    '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
  wf.async = 'true';
  document.head.appendChild(wf);
})(window);