Skip to content

Public API

The plugin exposes a public API that can be consumed by other plugins through Rollup inter-plugin communication.

getGeneratedWebfonts

  • Returns: Array<{ type: 'svg' | 'ttf' | 'woff2' | 'woff' | 'eot'; href: string }>

Each returned item contains:

  • type: the generated font format
  • href: the path to the generated font asset

This is useful when another plugin needs to inspect or reuse the font files generated by vite-svg-2-webfont.

See vite-plugin-preload-webfont for an example integration.

TIP

The awesome vite-plugin-preload-webfont plugin was since merged into vite-svg-2-webfont as an optional built-in feature. If you only need to inject preload tags for fonts generated by vite-svg-2-webfont, consider using the built-in preloadFormats and shouldProcessHtml options instead of a separate plugin.

Released under the MIT License.