How to add fonts to create-react-app based projects?

前端 未结 7 1772
长情又很酷
长情又很酷 2020-11-29 15:19

I\'m using create-react-app and prefer not to eject.

It\'s not clear where fonts imported via @font-face and loaded locally should go.

Namely,

7条回答
  •  南方客
    南方客 (楼主)
    2020-11-29 15:43

    I was making mistakes like this.

    @import "https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i&subset=cyrillic,cyrillic-ext,latin-ext";
    @import "https://use.fontawesome.com/releases/v5.3.1/css/all.css";
    

    It works properly this way

    @import url(https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i&subset=cyrillic,cyrillic-ext,latin-ext);
    @import url(https://use.fontawesome.com/releases/v5.3.1/css/all.css);
    

提交回复
热议问题