An API route for Makeswift that adds support for preview mode, on-demand revalidation, and other features that make Makeswift work seamlessly with your Next.js app.
The API key for the Makeswift site.
Options for site version and locale.
An instance of ReactRuntime
This function is called when the builder requests the list of fonts available for the site. The function should return an array of FontFamily objects.
The src field is used to preview the font in the builder. The src field can be either a relative or absolute URL. If the src field is omitted, the font is still selectable but uses a fallback font in the builder.
An object containing event handlers for the Makeswift site.
If defined, this function is called when the site is published.
Any errors thrown in the event handler will be logged and ignored.
Since onPublish is powered by Makeswift webhooks, it’s not possible to test them locally (e.g., localhost:3000) at this time. We have plans to enable this via tunneling by leveraging the Makeswift CLI but don’t have that ready just yet.
The following example adds Spline Sans and Spline Sans Mono Google Fonts to the site using next/font and adds them to the MakeswiftApiHandler.
For more information on adding fonts to your Next.js app, see our Adding Fonts guide.
We recommend using variable fonts as they reduce the number of font files requested.
onPublish event