Registry / devops / rollup-plugin-bundle-fonts

rollup-plugin-bundle-fonts

JSON →
library1.2.1jsnpmunverified

A Rollup plugin that downloads HTTPS fonts referenced in CSS `url()` functions and copies them to a target directory, updating the URLs to relative paths. Current version 1.2.1, compatible with Rollup 3.0+ and Node.js LTS v16+. Unlike generic asset plugins, it specifically handles font downloading with optional download delays, include/exclude patterns, and automatic URL rewriting based on CSS bundle location. Does not clear the font directory between runs, only downloads missing fonts.

npm install rollup-plugin-bundle-fonts
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-BUND
R
rollup-plugin-bundle-fonts
devopsjavascriptv1.2.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import bundleFonts from 'rollup-plugin-bundle-fonts'
const bundleFonts = require('rollup-plugin-bundle-fonts')
Default export. ESM-only; CommonJS require will fail. Use import.
bundleFonts
import bundleFonts from 'rollup-plugin-bundle-fonts'
import { bundleFonts } from 'rollup-plugin-bundle-fonts'
Do not use named import. The package exports a default function.

Basic Rollup config using bundleFonts plugin with required options fontTargetDir and cssBundleDir, plus optional delay.

import bundleFonts from 'rollup-plugin-bundle-fonts'; export default { input: 'src/index.js', output: { file: 'dist/bundle.js', format: 'es' }, plugins: [ bundleFonts({ fontTargetDir: 'dist/fonts', cssBundleDir: 'dist', delay: 100 }) ] };
Debug
Known issues
gotchafontTargetDir and cssBundleDir are required but not validated at build time; missing them causes runtime errors.
fix
Always provide both fontTargetDir and cssBundleDir options.
affects: >=1.0.0
gotchaThe plugin only downloads fonts that are missing in fontTargetDir; existing files are not overwritten.
fix
Manually delete the font directory between builds if you need fresh downloads.
affects: >=1.0.0
gotchaDelay option is in microseconds, not milliseconds. A typical delay of 100 means 0.1 ms.
fix
To add 1 second delay, set delay to 1000000.
affects: >=1.1.0
Errors
Common errors & fixes
Cannot find module 'rollup-plugin-bundle-fonts'
The plugin is not installed or is installed as devDependency but missing from node_modules.
fix
Run 'npm install rollup-plugin-bundle-fonts --save-dev' and ensure node_modules exists.
TypeError: bundleFonts is not a function
Using named import instead of default import.
fix
Use 'import bundleFonts from 'rollup-plugin-bundle-fonts'' (without curly braces).
Upgrade
Version history
1.2.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
rollup-plugin-bundle-fonts — npm install rollup-plugin-bundle-fonts · libregistry