问题
I'm trying to import a google font into my a sass file, right at the top before all other styles.
I am using webpack laravel mix, and I am also using the google font v2 API link.
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@500;600;700;800;900&display=swap");
The problem with the new css2 link, it contains semi-colons and creates css parse errors.
The sass file actually compiles fine, but this is the output of the css file...
@import url(https://fonts.googleapis.com/css2?family=Inter:wght@500;
600;700;800;900&display=swap);@charset "UTF-8";
Which is not valid, and the main fonts do not work, only the fallback font san-serif
works.
The only way I've found to temporarily get round this problem is to use the old url. But I would rather use the latest google v2 url.
@import url("https://fonts.googleapis.com/css?family=Inter:500,600,700,800,900");
来源:https://stackoverflow.com/questions/63505687/how-to-use-the-google-font-v2-api-import-url-in-sass-file-with-webpack-laravel-m