Code Monkey home page Code Monkey logo

Comments (5)

joe-bell avatar joe-bell commented on May 28, 2024 2

Just to clarify, next-google-fonts offers non-priority/asynchronous loading for Google Fonts, whereas the experimental font optimization changes are priorirty/synchronous.

I had a great convo with @prateekbh about this and you can read more here: vercel/next.js#16065

Cheers for the heads up! Perhaps it's worth me adding to the README?

from next-google-fonts.

prateekbh avatar prateekbh commented on May 28, 2024 1

FWIW I totally enjoyed brain storming with you on the discussion. This is a great solution if you decide to load fonts in a non-priority/asynchronous manner and would recommend.

from next-google-fonts.

elliottpost avatar elliottpost commented on May 28, 2024 1

Thanks, @joe-bell for the clarification! I think given that NextJS 10 moves this feature from experimental to core it's probably worth updating the README. The quickest short-term solution might just be to link to this ticket to save you from answering the same question multiple times over 😅

I use this package on my NextJS 9.5 install and it works fantastic, but when we update to NextJS 10, I'll probably opt for inline CSS since it's just a few fonts and FOUT can be avoided by inlining it at the trade off for a slightly longer initial load time. Thanks for the help!

from next-google-fonts.

joe-bell avatar joe-bell commented on May 28, 2024 1

Done! Thanks @elliottpost

from next-google-fonts.

Tosheen avatar Tosheen commented on May 28, 2024

Hello,
I am using nextjs v10 and its still confusing how to work with google fonts. Does the optimization comes by default now or not? Google page insights complains about the fonts and I have no idea how to solve it and I tried many things.
This is the code in my _document.js file but I dont see any benefits.

<link rel="preconnect" href="https://fonts.gstatic.com" />
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600&family=Roboto:wght@300;400;500&family=Work+Sans:wght@400;500;600;700&display=swap" rel="stylesheet"  />

Is there anything else I should be doing? Link to a working example would be awesome.

from next-google-fonts.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.