Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialjason limmm
8,009 Pointshow can i import a font from google fonts into a pug file
i don't know how to import a font from google fonts in a pug file. i heard about importing the font into a stylesheet and link it there but i heard it's bad for page performance
1 Answer
Rohald van Merode
Treehouse StaffHey jason limmm 👋
You can import Google Fonts in a similar way as you would with regular HTML files by simply adding a link
tag in the head
.
For example:
head
link(rel="preconnect" href="https://fonts.googleapis.com")
link(rel="preconnect" href="https://fonts.gstatic.com" crossorigin)
link(href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet")
Hope this helps!