How to use the google font v2 API import url in sass file with webpack laravel mix?

Viewed 462

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.

enter image description here


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");
0 Answers
Related