Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@preco21/next-fonts

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@preco21/next-fonts

Import font files in your Next.js project

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Next.js + Fonts

Import font files in your Next.js project.

The fonts will be added to .next/static/fonts. Also a chunk hash is added to file names in production.

Install

$ npm install --dev @preco21/next-fonts

Usage

In next.config.js:

const withFonts = require('@preco21/next-fonts')
module.exports = withFonts()

Optionally extend the config as you like:

const withFonts = require('@preco21/next-fonts')
module.exports = withFonts({
  webpack(config, options) {
    return config
  }
})

Options

This plugin accepts a number of options that you can customize the build:

module.exports = withFonts({
  extensions: ['woff', 'woff2'],
  urlLoaderOptions: {
    limit: 10000
  }
})

extensions

Type: string[]
Default: ['woff', 'woff2', 'eot', 'ttf', 'otf']

Specify a extension set on which files to identify as a fonts.

include

Type: RegExp

Same as the original webpack's Rule.include.

exclude

Type: RegExp

Same as the original webpack's Rule.exclude.

urlLoaderOptions

Type: object

Same as the original url-loader's option.

assetPrefix

Type: string
Default: ''

Same as the original assetPrefix option, consumed in the plugin to resolve the domain the Next.js is hosted on.

License

MIT

Keywords

FAQs

Package last updated on 24 Jul 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc