Registry / devops / rollup-plugin-mdi-fontmin

rollup-plugin-mdi-fontmin

JSON →
library1.2.7jsnpmunverified

A Rollup plugin that subsets Material Design Icons (MDI) font files to include only the icons you specify. Current version is 1.2.7 (stable, maintained). It leverages fontmin to generate reduced TTF, EOT, WOFF, and WOFF2 files and patches the CSS accordingly. Unlike generic font subsetters, it is tightly integrated with MDI's naming conventions and Rollup's build pipeline. Works with @mdi/font v1–v7 and Rollup v1–v4.

npm install rollup-plugin-mdi-fontmin
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-MDI-
R
rollup-plugin-mdi-fontmin
devopsjavascriptv1.2.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

mdiFontmin (default)
import mdiFontmin from 'rollup-plugin-mdi-fontmin'
const mdiFontmin = require('rollup-plugin-mdi-fontmin')
Package is ESM-only since v1.2.0. Use named import or require('rollup-plugin-mdi-fontmin').default does not work.
mdiFontmin (default)
const mdiFontmin = require('rollup-plugin-mdi-fontmin')
const { mdiFontmin } = require('rollup-plugin-mdi-fontmin')
CommonJS require returns the plugin function directly, not as named export.
TypeScript types
import mdiFontmin from 'rollup-plugin-mdi-fontmin'
Types are included in the package; no separate @types package needed. Use with TypeScript >=4.0.

Shows typical Rollup configuration using the plugin with required 'names' option and custom output directory.

// rollup.config.js import mdiFontmin from 'rollup-plugin-mdi-fontmin'; import { defineConfig } from 'rollup'; export default defineConfig({ input: 'src/index.js', output: { dir: 'dist', format: 'esm' }, plugins: [ mdiFontmin({ names: ['home', 'account', 'settings'], output: 'public/fonts/mdi', silent: false, logPrefix: '[mdi]' }) ] });
Debug
Known issues
gotchaThe 'names' option is required and must be an array of strings (icon names without 'mdi-' prefix). If omitted or empty, an error is thrown.
fix
Provide a non-empty array like ['home', 'account'].
affects: >=1.0.0
gotchaThe output directory must exist or be creatable; plugin does not create nested directories implicitly.
fix
Use `mkdir -p public/fonts/mdi` or ensure parent directories exist before build.
affects: >=1.0.0
gotchaIf the subsetted font files already exist in the output directory, the plugin skips generation. To force regeneration, delete the output files.
fix
Clean the output directory before each build (e.g., using rollup-plugin-clean or rimraf).
affects: >=1.0.0
deprecatedSupport for fontmin@1 is available but considered legacy. fontmin@2 is recommended.
fix
Install fontmin@2: `npm install fontmin --save-dev` or `npm install fontmin@2 --save-dev`.
affects: >=1.2.0
breakingIn v1.0.0, the plugin was CommonJS-only. Starting v1.2.0, the package is ESM-only and requires Node >=18.
fix
Use ESM imports and Node 18+. For older Node, pin to v1.1.x.
affects: >=1.2.0
Errors
Common errors & fixes
Error: Cannot find module 'rollup-plugin-mdi-fontmin'
The package is ESM-only as of v1.2.0 and cannot be required with CommonJS in older Node versions or when 'type': 'module' is not set.
fix
In package.json add "type": "module" or use .mjs extension for config file, or pin to v1.1.x: `npm install rollup-plugin-mdi-fontmin@1.1.0`
The "names" option is required.
Plugin was initialized without the required 'names' option.
fix
Pass an array of icon names: `mdiFontmin({ names: ['home', 'account'] })`
[!] Plugin mdi-fontmin: Could not find icons: ['foo']
The icon name 'foo' is not a valid Material Design Icon (check case and prefix).
fix
Verify icon names exist in the MDI set (use lowercase, no 'mdi-' prefix). E.g., 'home' not 'Home' or 'mdi-home'.
Upgrade
Version history
1.2.7latest on npm
Audit
Dependencies
@mdi/fontrequiredProvides the full Material Design Icons font and CSS from which subsets are extracted.
fontminrequiredPerforms the actual font subsetting (glyph extraction and conversion).
rolluprequiredRequired as a peer dependency to integrate as a Rollup plugin.
Agent activity
4 hits · last 30 days
node
4
Resources
rollup-plugin-mdi-fontmin — npm install rollup-plugin-mdi-fontmin · libregistry