Search code examples
javascriptfontsrequirejsgoogle-webfonts

Loading Google Web Fonts using require.js font plugin


I'm using https://github.com/millermedeiros/requirejs-plugins to load the google font and it works fine for the basic font.

require.config({
  paths : {
    font: 'lib/require/font',
  }
});

define([
  'font!google,families:[Roboto]'
  ], function(){
    //all dependencies are loaded
  }
);

the above is fine, but if I try Roboto:400,500,700,900, it won't work to load the bolder fonts.


Solution

  • define(['backbone','app-init','font!google,families:[Yanone Kaffeesatz:700]'],
       function(Backbone, AppInit,Font) {
          AppInit.initialize();
       }
    );