使用require.js字体插件加载Google Web字体 [英] Loading Google Web Fonts using require.js font plugin

查看:326
本文介绍了使用require.js字体插件加载Google Web字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 https://github.com/millermedeiros/requirejs-plugins 来加载google字体,并且对于基本字体的效果很好。

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
  }
);

以上是罚款,但是如果我尝试 Roboto:400,500,700,900

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

推荐答案

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

这篇关于使用require.js字体插件加载Google Web字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆