Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@next/font
Advanced tools
`@next/font` includes built-in automatic self-hosting for any font file. This means you can optimally load web fonts with zero layout shift, thanks to the underlying CSS size-adjust property used.
@next/font is a package designed to optimize and manage fonts in Next.js applications. It provides a streamlined way to include and configure custom fonts, Google Fonts, and local fonts, ensuring better performance and easier font management.
Custom Fonts
This feature allows you to include custom fonts in your Next.js application by specifying the font source, weight, and style.
import { createFont } from '@next/font';
const myFont = createFont({
src: '/path/to/font.woff2',
weight: '400',
style: 'normal'
});
export default function MyApp() {
return (
<div style={{ fontFamily: myFont }}>Hello, world!</div>
);
}
Google Fonts
This feature allows you to easily include Google Fonts in your Next.js application by specifying the font family, weights, and styles.
import { createGoogleFont } from '@next/font';
const roboto = createGoogleFont({
family: 'Roboto',
weights: ['400', '700'],
styles: ['normal', 'italic']
});
export default function MyApp() {
return (
<div style={{ fontFamily: roboto }}>Hello, world!</div>
);
}
Local Fonts
This feature allows you to include local fonts in your Next.js application by specifying the local path to the font file, weight, and style.
import { createLocalFont } from '@next/font';
const localFont = createLocalFont({
src: '/local/path/to/font.woff2',
weight: '400',
style: 'normal'
});
export default function MyApp() {
return (
<div style={{ fontFamily: localFont }}>Hello, world!</div>
);
}
The 'typeface' package allows you to self-host fonts by providing a collection of pre-packaged fonts. It simplifies the process of including fonts in your project but does not offer the same level of integration with Next.js as @next/font.
The 'webfontloader' package is a JavaScript library for loading web fonts. It supports Google Fonts, Typekit, and custom fonts. While it is versatile, it requires more manual setup compared to the streamlined approach of @next/font.
@next/font
@next/font
includes built-in automatic self-hosting for any font file. This means you can optimally load web fonts with zero layout shift, thanks to the underlying CSS size-adjust property used.
This new font system also allows you to conveniently use all Google Fonts with performance and privacy in mind. CSS and font files are downloaded at build time and self-hosted with the rest of your static assets. No requests are sent to Google by the browser.
FAQs
`@next/font` includes built-in automatic self-hosting for any font file. This means you can optimally load web fonts with zero layout shift, thanks to the underlying CSS size-adjust property used.
The npm package @next/font receives a total of 88,893 weekly downloads. As such, @next/font popularity was classified as popular.
We found that @next/font demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.