美文网首页
使用font-roboto-local

使用font-roboto-local

作者: butterandfly | 来源:发表于2016-11-14 12:46 被阅读0次

    font-roboto的问题

    font-roboto是一个字体组件,引入后能使用google的roboto字体。因为被"paper-styles"使用,所以基本上会被大多数的Paper元素依赖。
    但是,font-roboto使用了一个在线的(fonts.googleapis.com)字体文件。这样会导致:

    • 离线的客户端如electron会出问题
    • 墙内用户会有问题...

    所以,我一般会使用font-roboto-local来代替。

    使用font-roboto-local

    首先,删去已经在bower_components里存在的font-roboto。
    然后,修改bower.json,在dependencies下添加:

        "font-roboto": "PolymerElements/font-roboto-local#1.0.0"
    

    单这个还不够,还要修改resolutions:

      "resolutions": {
        "font-roboto": "1.0.0"
      }
    

    重新执行bower install,就可以了。

    相关文章

      网友评论

          本文标题:使用font-roboto-local

          本文链接:https://www.haomeiwen.com/subject/czshpttx.html