vite-plugin-svg-icons-ng
Version:
Vite plugin for easily creating an SVG sprite and injecting it for use, with a brand-new version.
60 lines (56 loc) • 1.54 kB
text/typescript
import { Plugin } from 'vite';
import { Options as Options$1 } from 'svg-icon-baker';
type InjectMode = 'body-first' | 'body-last';
type HtmlMode = 'script' | 'inline' | 'none';
type StrokeOverride = boolean | string;
type Options = {
/**
* icons store directories
* all svg files in these will be converted to svg sprite.
* @requires true
*/
iconDirs: string[];
/**
* icon name format
* @default icon-[dir]-[name]
*/
symbolId?: string;
/**
* icon format
* @default 'body-last'
*/
inject?: InjectMode;
/**
* html sprite generation mode
* @default 'inline'
*/
htmlMode?: HtmlMode;
/**
* custom dom id
* @default '__svg__icons__dom__'
*/
customDomId?: string;
/**
* override `stroke` attribute
* `false` to disable, `true` to override as `currentColor`, or an object `{ color: '#fff' }`
* @default false
*/
strokeOverride?: StrokeOverride;
/**
* throw on invalid svg transform error.
* when false, print warning and skip the broken icon.
* @default: false
*/
failOnError?: boolean;
/**
* **Advanced options**
*
* Directly customize the underlying svg-icon-baker bundle.
* see [svg-icon-baker](https://www.npmjs.com/package/svg-icon-baker) for more details
* @default {}
*/
bakerOptions?: Options$1;
};
declare function createSvgIconsPlugin(userOptions: Options): Plugin;
export { createSvgIconsPlugin };
export type { Options };