Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

nhayder's avatar
Level 13

pulling google fonts through npm not working but CDN dose

in my app i'm pulling a couple of google fonts through npm like this

app.scss

// Fonts
@import url('https://fonts.googleapis.com/css?family=Amiri|Aref+Ruqaa|Baloo+Bhaijaan|Cairo|Changa|El+Messiri|Harmattan|Jomhuria|Katibeh|Lalezar|Lateef|Lemonada|Mada|Markazi+Text|Mirza|Rakkas|Reem+Kufi|Scheherazade|Tajawal');

then i did npm run production, and it look like the font where included on my compiled app.css

@import url(https://fonts.googleapis.com/css?family=Amiri|Aref+Ruqaa|Baloo+Bhaijaan|Cairo|Changa|El+Messiri|Harmattan|Jomhuria|Katibeh|Lalezar|Lateef|Lemonada|Mada|Markazi+Text|Mirza|Rakkas|Reem+Kufi|Scheherazade|Tajawal);

on my front end page i have included the compiles app.css i have this

<link href="{{ mix('/css/app.css') }}" rel="stylesheet">

now all css stylesheet are loaded correctly except google font, All font are not being changed and i cant see the effect of google fonts across the entire front end.

strangely enough if i include google fonts as CDN i can see fonts taking effects ???

any ideas ???

0 likes
2 replies
bobbybouwmann's avatar

This should work perfectly fine

// Google Fonts
@import url(https://fonts.googleapis.com/css?family=Amiri|Aref+Ruqaa|Baloo+Bhaijaan|Cairo|Changa|El+Messiri|Harmattan|Jomhuria|Katibeh|Lalezar|Lateef|Lemonada|Mada|Markazi+Text|Mirza|Rakkas|Reem+Kufi|Scheherazade|Tajawal);

// Font Variables
$amiri: 'Amiri', serif;   
$cairo: 'Cairo', serif;   
$harmattan: 'Harmattan', serif;   

// Styles
body {
    font-family: $amiri;
}

Well, you get the idea ;)

Please or to participate in this conversation.