File containg all google font URLs

怎甘沉沦 提交于 2019-12-13 07:18:57

问题


I'm building a set of utilities for applying google fonts - superfly-css-utilities-fonts.

I would like to include all the Google font urls such that the utility classes can be built like this:

    @import url('https://fonts.googleapis.com/css?family=Open+Sans');
    @import url('https://fonts.googleapis.com/css?family=Montserrat');
    @import url('https://fonts.googleapis.com/css?family=Roboto');
    @import url('https://fonts.googleapis.com/css?family=Lato');

    /** All fonts fallback to the same variable - FIX **/
    @each $font in Open+Sans, Montserrat, Roboto, Lato {
        .u-font-$(font) {
          font-family: $(font) !important;
        }
    }

Anyone know if theres a file containing all the @import statements for all the google fonts? That way I could just import that file. If there existed a comma separated list of all the font names that could be used in the each loop that would be awesome.

This work is going into an MIT licensed utility library.


回答1:


Import all Google Fonts

Easy Fonts allows you to load selective fonts, or all fonts at once. It also includes CSS classes for all fonts so that you do not have to edit CSS to make fonts to work.

<link href="https://pagecdn.io/lib/easyfonts/fonts.css" rel="stylesheet" />


来源:https://stackoverflow.com/questions/42660747/file-containg-all-google-font-urls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!