JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 119777
  • Score
    100M100P100Q145822F
  • License MIT

Package Exports

  • next-fonts

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (next-fonts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Next.js + Fonts

Import fonts in Next.js (woff, woff2, eot, ttf, otf & svg)

Installation

npm install --save next-fonts

or

yarn add next-fonts

Usage

Create a next.config.js in your project

// next.config.js
const withFonts = require('next-fonts');
module.exports = withFonts();

Optionally you can add your custom Next.js configuration as parameter

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

assetPrefix

You can serve remote resources by setting assetPrefix option.

Example usage:

// next.config.js
const withFonts = require('next-fonts');
module.exports = withFonts({
  assetPrefix: 'https://example.com',
  webpack(config, options) {
    return config;
  }
});

Include SVG fonts

You can also (optionally) include SVG fonts by setting enableSvg option.

Example usage:

// next.config.js
const withFonts = require('next-fonts');
module.exports = withFonts({
  enableSvg: true,
  webpack(config, options) {
    return config;
  }
});

Styled components

Please see https://github.com/rohanray/font-error for sample code to use with styled components. Live URL : https://type-error-idfldxadbv.now.sh