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 pre
Imo, if you're using VueJS, Google Fonts Webpack Plugin is the way.
Here's the plugin, it's really easy to set it up and works like a charm.
npm i google-fonts-webpack-plugin -D
Go to your /webpack.config.js
/ webpack.base.config.js
and add the following lines:
const GoogleFontsPlugin = require("google-fonts-webpack-plugin")
module.exports = {
"entry": "index.js",
/* ... */
plugins: [
new GoogleFontsPlugin({
fonts: [
{ family: "Source Sans Pro" },
{ family: "Roboto", variants: [ "400", "700italic" ] }
]
})
]
}
Now you can use Google Fonts anywhere inside your VueJS project :)