UNPKG

vite-plugin-material-symbols

Version:

Selective loading of Material Symbols for production

40 lines 1.42 kB
import { Plugin } from "vite"; //#region src/index.d.ts type PluginOptions = { /** * The regex to match module IDs that should be processed for finding icon names * @default /\.([jt])sx?$/i * */ moduleIdRegex: RegExp; /** * The regex to match JSX nodes that should be processed in parsed AST (e.g. "jsx", "_jsx" or "jsxs") * @default /jsx/ * */ jsxNodeRegex: RegExp; /** * Material Symbols CSS Provider. Default: outlined, no infill, 24px, weight 400 * @see https://fonts.google.com/icons?icon.set=Material+Symbols * @default "https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0" * */ fontUrl: string; /** * The name of the query parameter to add to the fontUrl * @default "icon_names" * */ paramName: string; /** * The name of JSX component to get the icon names from (or regex to match the component name) * @default "Icon" * */ component: string | RegExp; /** * Enables higher priority for loading symbols * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preload * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preconnect * @default false */ preload: boolean; }; declare const plugin: ({ moduleIdRegex, jsxNodeRegex, component, fontUrl, paramName, preload }?: Partial<PluginOptions>) => Plugin; //#endregion export { plugin as default };