How do I add a Google Font to a VueJS Component?

前端 未结 7 2129
离开以前
离开以前 2021-02-03 20:42

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

7条回答
  •  我寻月下人不归
    2021-02-03 21:28

    Don't use the google-fonts-webpack-plugin package nor the google-fonts-plugin. They don't work with Vue.

    Using @import doesn't solve the problem neither, if you want to do a PWA and use the fonts offline.

    The solution I used was to use fontsource, they have all Google Fonts. Just install the font you want with yarn and then import it in your SASS.

提交回复
热议问题