next-google-fonts | tiny Next.js helper for loading Google Fonts fast
kandi X-RAY | next-google-fonts Summary
kandi X-RAY | next-google-fonts Summary
As of Next.js 10.2, Google Fonts are automatically optimized . Thanks for all your love and support for this project, Joe.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of next-google-fonts
next-google-fonts Key Features
next-google-fonts Examples and Code Snippets
Community Discussions
Trending Discussions on next-google-fonts
QUESTION
I have tried to create a custom email receipt template with SendGrid using commercejs webhooks, by following this tutorial. I have uploaded this github repository to
this test Netlify site. The main code is /functions/email.js
I am pretty sure my .env
variables are correct, still no receipt emails are received and probably send. When checking the Netlify function email log says:
ANSWER
Answered 2021-Oct-03 at 23:57Twilio SendGrid developer evangelist here.
You have installed node-fetch to the project, but the tutorial did not include requiring the library into the function to use it. So you need to require node-fetch
.
The tutorial also fails to require the SendGrid library and set the API key. You should set your SendGrid API key in the environment in Netlify, called something like SENDGRID_API_KEY
. Then add the following to the top of your function:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install next-google-fonts
Add the package to your Next.js project: npm i next-google-fonts
Create a custom Head component. It's important to acknowledge that next-google-fonts is a small next/head component and should not be nested inside next/head. To solve this, wrap both components with a Fragment. // components/head.js import * as React from "react"; import NextHead from "next/head"; import { GoogleFonts } from "next-google-fonts"; export const Head = ({ children, title }) => ( <React.Fragment> <GoogleFonts href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" /> <NextHead> <meta charSet="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta httpEquiv="x-ua-compatible" content="ie=edge" /> <title>{title}</title> {children} </NextHead> </React.Fragment> );
Add the requested Google Font/s to your styles with a sensible fallback. It really doesn't matter whether you're using CSS or Sass or CSS-in-JS: body { font-family: "Inter", sans-serif; }
Run your Next.js app to see the results in action! You should expect to see the fallback font first, followed by a switch to the Google Font/s without any render-blocking CSS warnings. Your font/s will continue to display until your app is re-hydrated. If JS is disabled, only the fallback font will display.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page