我正在尝试导入一个谷歌字体 https://fonts.google.com/specimen/Inter?sidebar.open=true&selection.family=Inter:wght@500;600;700;800;900进入我的 sass 文件,位于所有其他样式之前的顶部。
我在用webpack Laravel 混合 https://laravel.com/docs/7.x/mix,而且我也在使用谷歌字体 v2 API 链接 https://developers.google.com/fonts/docs/css2.
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@500;600;700;800;900&display=swap");
新的 css2 链接存在问题,它包含分号并会产生 css 解析错误。
sass 文件实际上编译得很好,但这是 css 文件的输出......
@import url(https://fonts.googleapis.com/css2?family=Inter:wght@500;
600;700;800;900&display=swap);@charset "UTF-8";
哪个无效,主要字体不起作用,只有后备字体san-serif
works.
我发现暂时解决此问题的唯一方法是使用旧网址。但我宁愿使用最新的 google v2 url。
@import url("https://fonts.googleapis.com/css?family=Inter:500,600,700,800,900");