问题
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