Comments (2)
Thanks for your comment! As of next.js 10.2.0 google fonts are automatically optimized already: https://nextjs.org/blog/next-10-2#automatic-webfont-optimization
from nextjs-advanced-starter.
Yes, although in the case of Next.js automatically optimizing webfonts, it's important to note the optimized stylesheet is still calling external resources (the .woff/.woff2 files) which are loaded from external sources. For example, the default Inter stylesheet loads the normal 400pt Inter .woff file from a URL that looks like this: https://fonts.gstatic.com/s/inter/v3/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuLyfAZxhjp-Ek-_EeAmM.woff. These requests are repeated for each included font-weight
and font-style
.
Though Google does a great job at optimizing, these are still external network requests. When using PWAs or running Next.js apps only on local networks (not common, but I have seen it done), having fonts available locally becomes important. Some small amount of your "advanced" users may need such a feature — for example, I am adding this on my end.
Also, for use-cases like running Next.js inside Electron, where the browser is known to support variable fonts, using a variable font (which Inter supports) is another way to eliminate 10+ network requests for full font-weight
support. (These variable fonts also have the added advantage of supporting in-between font-weight
values, like font-weight: 420
.)
Next.js works great with local fonts as well! See https://kirazhang.com/posts/nextjs-custom-fonts for an idea.
If undesired, this would also be easy to remove (just by deleting one folder) and it would also have no impact on performance if the user does not remove it. Plus, the Google Font plugin would still be the default, but the README could note the option of using local fonts.
Again — not my repo — so I'm not trying to force anything! I just think it might be worth considering :). Thank you!
from nextjs-advanced-starter.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nextjs-advanced-starter.