I've been trying for an hour to find a way to import a Google Font into a VueJS Component, but I cannot seem to find a solution, nothing worked yet, not even the stuff from previous StackOverflow questions. All the answers I've found are 1.5 to 2 years old now. I would appreciate it greatly if someone could suggest an up to date solution.
I am using VueJS2 + Webpack + Vue-cli
To add google fonts, search for the google fonts, select the font category and family, then select the font style of your choice. Once you select the font, “copy the font link”, from the “selected families windows” and paste it in the head section of the HTML file.
The fastest way is to import the font in a CSS file, for example App.css
, if all components should have it:
@import url('https://fonts.googleapis.com/css?family=Roboto+Condensed'); html, body { font-family: 'Roboto', sans-serif; } #app { font-family: 'Roboto', sans-serif; }
The import statement is also shown by Google Fonts.
Select your fonts, click on Embed
and then @import
at the selection window:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With