@types/svgo

  • Version 2.6.1
  • Published
  • 26.4 kB
  • 1 dependency
  • MIT license

Install

npm i @types/svgo
yarn add @types/svgo
pnpm add @types/svgo

Overview

TypeScript definitions for svgo

Index

Functions

Interfaces

Type Aliases

Functions

function extendDefaultPlugins

extendDefaultPlugins: (plugins: Plugin[]) => Plugin[];
  • If plugins field is specified default list is fully overrided. To extend default list use extendDefaultPlugins utility.

    To disable one of default plugins use active field.

    Deprecated

    Use preset-default plugin instead

function loadConfig

loadConfig: {
(configFile: string, cwd?: string): Promise<OptimizeOptions>;
(): Promise<OptimizeOptions>;
};
  • If you write a tool on top of svgo you might need a way to load svgo config.

    You can also specify relative or absolute path and customize current working directory.

function optimize

optimize: (
svgString: string | Buffer,
options?: OptimizeOptions
) => OptimizedSvg | OptimizedError;

    Interfaces

    interface CustomPlugin

    interface CustomPlugin<P extends object = never> {}

      property fn

      fn: (ast: any, params: P, info: any) => any;

        property name

        name: string;

          property params

          params?: P | undefined;

            property type

            type: 'perItem' | 'perItemReverse' | 'full';

              interface DefaultPlugin

              interface DefaultPlugin<N extends string, P = never> {}

                property active

                active?: boolean | undefined;

                  property name

                  name: N;

                    property params

                    params?: P | undefined;

                      interface Js2SvgOptions

                      interface Js2SvgOptions {}

                        property attrEnd

                        attrEnd?: string | undefined;
                        • '"'

                        property attrStart

                        attrStart?: string | undefined;
                        • '="'

                        property cdataEnd

                        cdataEnd?: string | undefined;
                        • ']]>'

                        property cdataStart

                        cdataStart?: string | undefined;
                        • '<![CDATA['

                        property commentEnd

                        commentEnd?: string | undefined;
                        • '-->'

                        property commentStart

                        commentStart?: string | undefined;
                        • '<!--'

                        property doctypeEnd

                        doctypeEnd?: string | undefined;
                        • '>'

                        property doctypeStart

                        doctypeStart?: string | undefined;
                        • '<!DOCTYPE'

                        property encodeEntity

                        encodeEntity?: ((char?: string) => string) | undefined;
                        • encodeEntity

                        property eol

                        eol?: 'lf' | 'crlf' | undefined;
                        • Allows to customize end of line characters which is usually resolved by os.EOL in node.

                        property finalNewline

                        finalNewline?: boolean | undefined;
                        • Ensures SVG output has a final newline which is required for some tools like git.

                        property indent

                        indent?: number | undefined;
                        • 4

                        property pretty

                        pretty?: boolean | undefined;
                        • false

                        property procInstEnd

                        procInstEnd?: string | undefined;
                        • '?>'

                        property procInstStart

                        procInstStart?: string | undefined;
                        • '<?'

                        property regEntities

                        regEntities?: RegExp | undefined;
                        • /[&'"<>]/g

                        property regValEntities

                        regValEntities?: RegExp | undefined;
                        • /[&"<>]/g

                        property tagCloseEnd

                        tagCloseEnd?: string | undefined;
                        • '>'

                        property tagCloseStart

                        tagCloseStart?: string | undefined;
                        • '</'

                        property tagOpenEnd

                        tagOpenEnd?: string | undefined;
                        • '>'

                        property tagOpenStart

                        tagOpenStart?: string | undefined;
                        • '<'

                        property tagShortEnd

                        tagShortEnd?: string | undefined;
                        • '/>'

                        property tagShortStart

                        tagShortStart?: string | undefined;
                        • '<'

                        property textEnd

                        textEnd?: string | undefined;
                        • ''

                        property textStart

                        textStart?: string | undefined;
                        • ''

                        property useShortTags

                        useShortTags?: boolean | undefined;
                        • true

                        interface OptimizedError

                        interface OptimizedError {}

                          property error

                          error: string;

                            property modernError

                            modernError: SvgoParserError;

                              interface OptimizedSvg

                              interface OptimizedSvg {}

                                property data

                                data: string;

                                  property error

                                  error: undefined;

                                    property info

                                    info: {
                                    width: string;
                                    height: string;
                                    };

                                      property modernError

                                      modernError: undefined;

                                        property path

                                        path?: string | undefined;

                                          interface OptimizeOptions

                                          interface OptimizeOptions {}

                                            property datauri

                                            datauri?: 'base64' | 'enc' | 'unenc' | undefined;
                                            • Output as Data URI string.

                                            property floatPrecision

                                            floatPrecision?: number | undefined;
                                            • Precision of floating point numbers. Will be passed to each plugin that suppors this param.

                                            property full

                                            full?: boolean | undefined;
                                            • Use full set of plugins.

                                            property js2svg

                                            js2svg?: Js2SvgOptions | undefined;
                                            • Options for rendering optimized SVG from AST.

                                            property multipass

                                            multipass?: boolean | undefined;
                                            • Pass over SVGs multiple times to ensure all optimizations are applied

                                            property path

                                            path?: string | undefined;

                                              property plugins

                                              plugins?: Plugin[] | undefined;
                                              • Individual plugin configurations. For specific options, see plugin source in https://github.com/svg/svgo/tree/master/plugins.

                                              property svg2js

                                              svg2js?: Svg2JsOptions | undefined;
                                              • Options for parsing original SVG into AST.

                                              interface Preset

                                              interface Preset<N extends string, P = never> {}

                                                property name

                                                name: N;

                                                  property params

                                                  params?: P | undefined;

                                                    interface Svg2JsOptions

                                                    interface Svg2JsOptions {}

                                                      property lowercase

                                                      lowercase?: boolean | undefined;
                                                      • true

                                                      property normalize

                                                      normalize?: boolean | undefined;
                                                      • true

                                                      property position

                                                      position?: boolean | undefined;
                                                      • true

                                                      property strict

                                                      strict?: boolean | undefined;
                                                      • true

                                                      property trim

                                                      trim?: boolean | undefined;
                                                      • false

                                                      property xmlns

                                                      xmlns?: boolean | undefined;
                                                      • true

                                                      interface SvgoParserError

                                                      interface SvgoParserError extends Error {}

                                                        property column

                                                        column: number;

                                                          property line

                                                          line: number;

                                                            property reason

                                                            reason: string;

                                                              property source

                                                              source: string;

                                                                Type Aliases

                                                                type AddAttributesToSVGElementPlugin

                                                                type AddAttributesToSVGElementPlugin = DefaultPlugin<'addAttributesToSVGElement'>;
                                                                • adds attributes to an outer element

                                                                type AddClassesToSVGElementPlugin

                                                                type AddClassesToSVGElementPlugin = DefaultPlugin<'addClassesToSVGElement'>;
                                                                • adds classnames to an outer element

                                                                type CleanupAttrsPlugin

                                                                type CleanupAttrsPlugin = DefaultPlugin<
                                                                'cleanupAttrs',
                                                                {
                                                                /** @default true */
                                                                newlines?: boolean | undefined;
                                                                /** @default true */
                                                                trim?: boolean | undefined;
                                                                /** @default true */
                                                                spaces?: boolean | undefined;
                                                                }
                                                                >;
                                                                • cleanups attributes from newlines, trailing and repeating spaces

                                                                type CleanupEnableBackgroundPlugin

                                                                type CleanupEnableBackgroundPlugin = DefaultPlugin<'cleanupEnableBackground'>;
                                                                • remove or cleanup enable-background attribute when possible

                                                                type CleanupIDsPlugin

                                                                type CleanupIDsPlugin = DefaultPlugin<
                                                                'cleanupIDs',
                                                                {
                                                                /** @default true */
                                                                remove?: boolean | undefined;
                                                                /** @default true */
                                                                minify?: boolean | undefined;
                                                                /** @default '' */
                                                                prefix?: string | undefined;
                                                                /** @default [] */
                                                                preserve?: any[] | undefined;
                                                                /** @default [] */
                                                                preservePrefixes?: any[] | undefined;
                                                                /** @default false */
                                                                force?: boolean | undefined;
                                                                }
                                                                >;
                                                                • removes unused IDs and minifies used

                                                                type CleanupListOfValuesPlugin

                                                                type CleanupListOfValuesPlugin = DefaultPlugin<
                                                                'cleanupListOfValues',
                                                                {
                                                                /** @default 3 */
                                                                floatPrecision?: number | undefined;
                                                                /** @default true */
                                                                leadingZero?: boolean | undefined;
                                                                /** @default true */
                                                                defaultPx?: boolean | undefined;
                                                                /** @default true */
                                                                convertToPx?: boolean | undefined;
                                                                }
                                                                >;
                                                                • rounds list of values to the fixed precision

                                                                type CleanupNumericValuesPlugin

                                                                type CleanupNumericValuesPlugin = DefaultPlugin<
                                                                'cleanupNumericValues',
                                                                {
                                                                /** @default 3 */
                                                                floatPrecision?: number | undefined;
                                                                /** @default true */
                                                                leadingZero?: boolean | undefined;
                                                                /** @default true */
                                                                defaultPx?: boolean | undefined;
                                                                /** @default true */
                                                                convertToPx?: boolean | undefined;
                                                                }
                                                                >;
                                                                • rounds numeric values to the fixed precision, removes default ‘px’ units

                                                                type CollapseGroupsPlugin

                                                                type CollapseGroupsPlugin = DefaultPlugin<'collapseGroups'>;
                                                                • collapses useless groups

                                                                type ConvertColorsPlugin

                                                                type ConvertColorsPlugin = DefaultPlugin<
                                                                'convertColors',
                                                                {
                                                                /** @default false */
                                                                currentColor?: boolean | undefined;
                                                                /** @default true */
                                                                names2hex?: boolean | undefined;
                                                                /** @default true */
                                                                rgb2hex?: boolean | undefined;
                                                                /** @default true */
                                                                shorthex?: boolean | undefined;
                                                                /** @default true */
                                                                shortname?: boolean | undefined;
                                                                }
                                                                >;
                                                                • converts colors: rgb() to #rrggbb and #rrggbb to #rgb

                                                                type ConvertEllipseToCirclePlugin

                                                                type ConvertEllipseToCirclePlugin = DefaultPlugin<'convertEllipseToCircle'>;
                                                                • converts non-eccentric s to s

                                                                type ConvertPathDataPlugin

                                                                type ConvertPathDataPlugin = DefaultPlugin<
                                                                'convertPathData',
                                                                {
                                                                /** @default true */
                                                                applyTransforms?: boolean | undefined;
                                                                /** @default true */
                                                                applyTransformsStroked?: boolean | undefined;
                                                                makeArcs?:
                                                                | {
                                                                /** @default 2.5 */
                                                                threshold?: number | undefined;
                                                                /** @default 0.5 */
                                                                tolerance?: number | undefined;
                                                                }
                                                                | undefined;
                                                                /** @default true */
                                                                straightCurves?: boolean | undefined;
                                                                /** @default true */
                                                                lineShorthands?: boolean | undefined;
                                                                /** @default true */
                                                                curveSmoothShorthands?: boolean | undefined;
                                                                /** @default 3 */
                                                                floatPrecision?: number | undefined;
                                                                /** @default 5 */
                                                                transformPrecision?: number | undefined;
                                                                /** @default true */
                                                                removeUseless?: boolean | undefined;
                                                                /** @default true */
                                                                collapseRepeated?: boolean | undefined;
                                                                /** @default true */
                                                                utilizeAbsolute?: boolean | undefined;
                                                                /** @default true */
                                                                leadingZero?: boolean | undefined;
                                                                /** @default true */
                                                                negativeExtraSpace?: boolean | undefined;
                                                                /** @default false */
                                                                noSpaceAfterFlags?: boolean | undefined;
                                                                /** @default false */
                                                                forceAbsolutePath?: boolean | undefined;
                                                                }
                                                                >;
                                                                • optimizes path data: writes in shorter form, applies transformations

                                                                type ConvertShapeToPathPlugin

                                                                type ConvertShapeToPathPlugin = DefaultPlugin<
                                                                'convertShapeToPath',
                                                                {
                                                                /** @default false */
                                                                convertArcs?: boolean | undefined;
                                                                }
                                                                >;
                                                                • converts basic shapes to more compact path form

                                                                type ConvertStyleToAttrsPlugin

                                                                type ConvertStyleToAttrsPlugin = DefaultPlugin<
                                                                'convertStyleToAttrs',
                                                                {
                                                                /** @default false */
                                                                keepImportant?: boolean | undefined;
                                                                }
                                                                >;
                                                                • converts style to attributes

                                                                type ConvertTransformPlugin

                                                                type ConvertTransformPlugin = DefaultPlugin<
                                                                'convertTransform',
                                                                {
                                                                /** @default true */
                                                                convertToShorts?: boolean | undefined;
                                                                /** @default 3 */
                                                                floatPrecision?: number | undefined;
                                                                /** @default 5 */
                                                                transformPrecision?: number | undefined;
                                                                /** @default true */
                                                                matrixToTransform?: boolean | undefined;
                                                                /** @default true */
                                                                shortTranslate?: boolean | undefined;
                                                                /** @default true */
                                                                shortScale?: boolean | undefined;
                                                                /** @default true */
                                                                shortRotate?: boolean | undefined;
                                                                /** @default true */
                                                                removeUseless?: boolean | undefined;
                                                                /** @default true */
                                                                collapseIntoOne?: boolean | undefined;
                                                                /** @default true */
                                                                leadingZero?: boolean | undefined;
                                                                /** @default false */
                                                                negativeExtraSpace?: boolean | undefined;
                                                                }
                                                                >;
                                                                • collapses multiple transformations and optimizes it

                                                                type DefaultPlugins

                                                                type DefaultPlugins =
                                                                | DefaultPresetPlugins
                                                                | PresetDefault
                                                                | AddAttributesToSVGElementPlugin
                                                                | AddClassesToSVGElementPlugin
                                                                | CleanupListOfValuesPlugin
                                                                | ConvertStyleToAttrsPlugin
                                                                | PrefixIdsPlugin
                                                                | RemoveAttributesBySelectorPlugin
                                                                | RemoveAttrsPlugin
                                                                | RemoveDimensionsPlugin
                                                                | RemoveElementsByAttrPlugin
                                                                | RemoveOffCanvasPathsPlugin
                                                                | RemoveRasterImagesPlugin
                                                                | RemoveScriptElementPlugin
                                                                | RemoveStyleElementPlugin
                                                                | RemoveXMLNSPlugin
                                                                | ReusePathsPlugin
                                                                | SortAttrsPlugin;

                                                                  type DefaultPresetPlugins

                                                                  type DefaultPresetPlugins =
                                                                  | CleanupAttrsPlugin
                                                                  | CleanupEnableBackgroundPlugin
                                                                  | CleanupIDsPlugin
                                                                  | CleanupNumericValuesPlugin
                                                                  | CollapseGroupsPlugin
                                                                  | ConvertColorsPlugin
                                                                  | ConvertEllipseToCirclePlugin
                                                                  | ConvertPathDataPlugin
                                                                  | ConvertShapeToPathPlugin
                                                                  | ConvertTransformPlugin
                                                                  | InlineStylesPlugin
                                                                  | MergePathsPlugin
                                                                  | MergeStylesPlugin
                                                                  | MinifyStylesPlugin
                                                                  | MoveElemsAttrsToGroupPlugin
                                                                  | MoveGroupAttrsToElemsPlugin
                                                                  | RemoveCommentsPlugin
                                                                  | RemoveDescPlugin
                                                                  | RemoveDoctypePlugin
                                                                  | RemoveEditorsNSDataPlugin
                                                                  | RemoveEmptyAttrsPlugin
                                                                  | RemoveEmptyContainersPlugin
                                                                  | RemoveEmptyTextPlugin
                                                                  | RemoveHiddenElemsPlugin
                                                                  | RemoveMetadataPlugin
                                                                  | RemoveNonInheritableGroupAttrsPlugin
                                                                  | RemoveTitlePlugin
                                                                  | RemoveUnknownsAndDefaultsPlugin
                                                                  | RemoveUnusedNSPlugin
                                                                  | RemoveUselessDefsPlugin
                                                                  | RemoveUselessStrokeAndFillPlugin
                                                                  | RemoveViewBoxPlugin
                                                                  | RemoveXMLProcInstPlugin
                                                                  | SortDefsChildrenPlugin;
                                                                  • plugins which are enabled in default preset

                                                                  type InlineStylesPlugin

                                                                  type InlineStylesPlugin = DefaultPlugin<
                                                                  'inlineStyles',
                                                                  {
                                                                  /** @default true */
                                                                  onlyMatchedOnce?: boolean | undefined;
                                                                  /** @default true */
                                                                  removeMatchedSelectors?: boolean | undefined;
                                                                  /** @default ['', 'screen'] */
                                                                  useMqs?: string[] | undefined;
                                                                  /** @default [''] */
                                                                  usePseudos?: string[] | undefined;
                                                                  }
                                                                  >;
                                                                  • inline styles (additional options)

                                                                  type MergePathsPlugin

                                                                  type MergePathsPlugin = DefaultPlugin<
                                                                  'mergePaths',
                                                                  {
                                                                  /** @default true */
                                                                  collapseRepeated?: boolean | undefined;
                                                                  /** @default false */
                                                                  force?: boolean | undefined;
                                                                  /** @default true */
                                                                  leadingZero?: boolean | undefined;
                                                                  /** @default true */
                                                                  negativeExtraSpace?: boolean | undefined;
                                                                  /** @default false */
                                                                  noSpaceAfterFlags?: boolean | undefined;
                                                                  }
                                                                  >;
                                                                  • merges multiple paths in one if possible

                                                                  type MergeStylesPlugin

                                                                  type MergeStylesPlugin = DefaultPlugin<'mergeStyles'>;
                                                                  • merge multiple style elements into one

                                                                  type MinifyStylesPlugin

                                                                  type MinifyStylesPlugin = DefaultPlugin<
                                                                  'minifyStyles',
                                                                  {
                                                                  usage: {
                                                                  /** @default false */
                                                                  force?: boolean | undefined;
                                                                  /** @default true */
                                                                  ids?: boolean | undefined;
                                                                  /** @default true */
                                                                  classes?: boolean | undefined;
                                                                  /** @default true */
                                                                  tags?: boolean | undefined;
                                                                  };
                                                                  }
                                                                  >;
                                                                  • minifies styles and removes unused styles based on usage data

                                                                  type MoveElemsAttrsToGroupPlugin

                                                                  type MoveElemsAttrsToGroupPlugin = DefaultPlugin<'moveElemsAttrsToGroup'>;
                                                                  • moves elements attributes to the existing group wrapper

                                                                  type MoveGroupAttrsToElemsPlugin

                                                                  type MoveGroupAttrsToElemsPlugin = DefaultPlugin<'moveGroupAttrsToElems'>;
                                                                  • moves some group attributes to the content elements

                                                                  type Plugin

                                                                  type Plugin = DefaultPlugins | DefaultPlugins['name'] | CustomPlugin;

                                                                    type PluginsPlugin

                                                                    type PluginsPlugin = DefaultPlugin<'plugins'>;
                                                                    • undefined

                                                                    type PrefixIdsPlugin

                                                                    type PrefixIdsPlugin = DefaultPlugin<
                                                                    'prefixIds',
                                                                    {
                                                                    /** @default '__' */
                                                                    delim?: string | undefined;
                                                                    /** @default true */
                                                                    prefixIds?: boolean | undefined;
                                                                    /** @default true */
                                                                    prefixClassNames?: boolean | undefined;
                                                                    }
                                                                    >;
                                                                    • prefix IDs

                                                                    type PresetDefault

                                                                    type PresetDefault = Preset<
                                                                    'preset-default',
                                                                    {
                                                                    floatPrecision?: number | undefined;
                                                                    overrides?: {
                                                                    [P in DefaultPresetPlugins['name']]?:
                                                                    | false
                                                                    | DefaultPresetPlugins['params'];
                                                                    };
                                                                    }
                                                                    >;
                                                                    • default plugin preset, customize plugin options by overriding them

                                                                    type RemoveAttributesBySelectorPlugin

                                                                    type RemoveAttributesBySelectorPlugin = DefaultPlugin<'removeAttributesBySelector'>;
                                                                    • removes attributes of elements that match a css selector

                                                                    type RemoveAttrsPlugin

                                                                    type RemoveAttrsPlugin = DefaultPlugin<
                                                                    'removeAttrs',
                                                                    {
                                                                    /** @default ':' */
                                                                    elemSeparator?: string | undefined;
                                                                    /** @default false */
                                                                    preserveCurrentColor?: boolean | undefined;
                                                                    /** @default [] */
                                                                    attrs: string | string[];
                                                                    }
                                                                    >;
                                                                    • removes specified attributes

                                                                    type RemoveCommentsPlugin

                                                                    type RemoveCommentsPlugin = DefaultPlugin<'removeComments'>;
                                                                    • removes comments

                                                                    type RemoveDescPlugin

                                                                    type RemoveDescPlugin = DefaultPlugin<
                                                                    'removeDesc',
                                                                    {
                                                                    /** @default true */
                                                                    removeAny?: boolean | undefined;
                                                                    }
                                                                    >;
                                                                    • removes

                                                                    type RemoveDimensionsPlugin

                                                                    type RemoveDimensionsPlugin = DefaultPlugin<'removeDimensions'>;
                                                                    • removes width and height in presence of viewBox (opposite to removeViewBox, disable it first)

                                                                    type RemoveDoctypePlugin

                                                                    type RemoveDoctypePlugin = DefaultPlugin<'removeDoctype'>;
                                                                    • removes doctype declaration

                                                                    type RemoveEditorsNSDataPlugin

                                                                    type RemoveEditorsNSDataPlugin = DefaultPlugin<
                                                                    'removeEditorsNSData',
                                                                    {
                                                                    /** @default [] */
                                                                    additionalNamespaces?: any[] | undefined;
                                                                    }
                                                                    >;
                                                                    • removes editors namespaces, elements and attributes

                                                                    type RemoveElementsByAttrPlugin

                                                                    type RemoveElementsByAttrPlugin = DefaultPlugin<
                                                                    'removeElementsByAttr',
                                                                    {
                                                                    /** @default [] */
                                                                    id?: any[] | undefined;
                                                                    /** @default [] */
                                                                    class?: any[] | undefined;
                                                                    }
                                                                    >;
                                                                    • removes arbitrary elements by ID or className (disabled by default)

                                                                    type RemoveEmptyAttrsPlugin

                                                                    type RemoveEmptyAttrsPlugin = DefaultPlugin<'removeEmptyAttrs'>;
                                                                    • removes empty attributes

                                                                    type RemoveEmptyContainersPlugin

                                                                    type RemoveEmptyContainersPlugin = DefaultPlugin<'removeEmptyContainers'>;
                                                                    • removes empty container elements

                                                                    type RemoveEmptyTextPlugin

                                                                    type RemoveEmptyTextPlugin = DefaultPlugin<
                                                                    'removeEmptyText',
                                                                    {
                                                                    /** @default true */
                                                                    text?: boolean | undefined;
                                                                    /** @default true */
                                                                    tspan?: boolean | undefined;
                                                                    /** @default true */
                                                                    tref?: boolean | undefined;
                                                                    }
                                                                    >;
                                                                    • removes empty elements

                                                                    type RemoveHiddenElemsPlugin

                                                                    type RemoveHiddenElemsPlugin = DefaultPlugin<
                                                                    'removeHiddenElems',
                                                                    {
                                                                    /** @default true */
                                                                    isHidden?: boolean | undefined;
                                                                    /** @default true */
                                                                    displayNone?: boolean | undefined;
                                                                    /** @default true */
                                                                    opacity0?: boolean | undefined;
                                                                    /** @default true */
                                                                    circleR0?: boolean | undefined;
                                                                    /** @default true */
                                                                    ellipseRX0?: boolean | undefined;
                                                                    /** @default true */
                                                                    ellipseRY0?: boolean | undefined;
                                                                    /** @default true */
                                                                    rectWidth0?: boolean | undefined;
                                                                    /** @default true */
                                                                    rectHeight0?: boolean | undefined;
                                                                    /** @default true */
                                                                    patternWidth0?: boolean | undefined;
                                                                    /** @default true */
                                                                    patternHeight0?: boolean | undefined;
                                                                    /** @default true */
                                                                    imageWidth0?: boolean | undefined;
                                                                    /** @default true */
                                                                    imageHeight0?: boolean | undefined;
                                                                    /** @default true */
                                                                    pathEmptyD?: boolean | undefined;
                                                                    /** @default true */
                                                                    polylineEmptyPoints?: boolean | undefined;
                                                                    /** @default true */
                                                                    polygonEmptyPoints?: boolean | undefined;
                                                                    }
                                                                    >;
                                                                    • removes hidden elements (zero sized, with absent attributes)

                                                                    type RemoveMetadataPlugin

                                                                    type RemoveMetadataPlugin = DefaultPlugin<'removeMetadata'>;
                                                                    • removes

                                                                    type RemoveNonInheritableGroupAttrsPlugin

                                                                    type RemoveNonInheritableGroupAttrsPlugin =
                                                                    DefaultPlugin<'removeNonInheritableGroupAttrs'>;
                                                                    • removes non-inheritable group’s presentational attributes

                                                                    type RemoveOffCanvasPathsPlugin

                                                                    type RemoveOffCanvasPathsPlugin = DefaultPlugin<'removeOffCanvasPaths'>;
                                                                    • removes elements that are drawn outside of the viewbox (disabled by default)

                                                                    type RemoveRasterImagesPlugin

                                                                    type RemoveRasterImagesPlugin = DefaultPlugin<'removeRasterImages'>;
                                                                    • removes raster images (disabled by default)

                                                                    type RemoveScriptElementPlugin

                                                                    type RemoveScriptElementPlugin = DefaultPlugin<'removeScriptElement'>;
                                                                    • removes elements (disabled by default)

                                                                    type RemoveStyleElementPlugin

                                                                    type RemoveStyleElementPlugin = DefaultPlugin<'removeStyleElement'>;
                                                                    • removes element (disabled by default)

                                                                    type RemoveTitlePlugin

                                                                    type RemoveTitlePlugin = DefaultPlugin<'removeTitle'>;
                                                                    • removes

                                                                    type RemoveUnknownsAndDefaultsPlugin

                                                                    type RemoveUnknownsAndDefaultsPlugin = DefaultPlugin<
                                                                    'removeUnknownsAndDefaults',
                                                                    {
                                                                    /** @default true */
                                                                    unknownContent?: boolean | undefined;
                                                                    /** @default true */
                                                                    unknownAttrs?: boolean | undefined;
                                                                    /** @default true */
                                                                    defaultAttrs?: boolean | undefined;
                                                                    /** @default true */
                                                                    uselessOverrides?: boolean | undefined;
                                                                    /** @default true */
                                                                    keepDataAttrs?: boolean | undefined;
                                                                    /** @default true */
                                                                    keepAriaAttrs?: boolean | undefined;
                                                                    /** @default false */
                                                                    keepRoleAttr?: boolean | undefined;
                                                                    }
                                                                    >;
                                                                    • removes unknown elements content and attributes, removes attrs with default values

                                                                    type RemoveUnusedNSPlugin

                                                                    type RemoveUnusedNSPlugin = DefaultPlugin<'removeUnusedNS'>;
                                                                    • removes unused namespaces declaration

                                                                    type RemoveUselessDefsPlugin

                                                                    type RemoveUselessDefsPlugin = DefaultPlugin<'removeUselessDefs'>;
                                                                    • removes elements in without id

                                                                    type RemoveUselessStrokeAndFillPlugin

                                                                    type RemoveUselessStrokeAndFillPlugin = DefaultPlugin<
                                                                    'removeUselessStrokeAndFill',
                                                                    {
                                                                    /** @default true */
                                                                    stroke?: boolean | undefined;
                                                                    /** @default true */
                                                                    fill?: boolean | undefined;
                                                                    /** @default false */
                                                                    removeNone?: boolean | undefined;
                                                                    /** @default false */
                                                                    hasStyleOrScript?: boolean | undefined;
                                                                    }
                                                                    >;
                                                                    • removes useless stroke and fill attributes

                                                                    type RemoveViewBoxPlugin

                                                                    type RemoveViewBoxPlugin = DefaultPlugin<'removeViewBox'>;
                                                                    • removes viewBox attribute when possible

                                                                    type RemoveXMLNSPlugin

                                                                    type RemoveXMLNSPlugin = DefaultPlugin<'removeXMLNS'>;
                                                                    • removes xmlns attribute (for inline svg, disabled by default)

                                                                    type RemoveXMLProcInstPlugin

                                                                    type RemoveXMLProcInstPlugin = DefaultPlugin<'removeXMLProcInst'>;
                                                                    • removes XML processing instructions

                                                                    type ReusePathsPlugin

                                                                    type ReusePathsPlugin = DefaultPlugin<'reusePaths'>;
                                                                    • finds elements with the same d, fill, and stroke, and converts them to elements referencing a single def.

                                                                    type SortAttrsPlugin

                                                                    type SortAttrsPlugin = DefaultPlugin<
                                                                    'sortAttrs',
                                                                    {
                                                                    /**
                                                                    * @default ['id', 'width', 'height', 'x', 'x1', 'x2', 'y', 'y1', 'y2', 'cx', 'cy', 'r', 'fill', 'stroke', 'marker', 'd', 'points']
                                                                    */
                                                                    order?: string[] | undefined;
                                                                    }
                                                                    >;
                                                                    • sorts element attributes (disabled by default)

                                                                    type SortDefsChildrenPlugin

                                                                    type SortDefsChildrenPlugin = DefaultPlugin<'sortDefsChildren'>;
                                                                    • sorts children of to improve compression

                                                                    Package Files (1)

                                                                    Dependencies (1)

                                                                    Dev Dependencies (0)

                                                                    No dev dependencies.

                                                                    Peer Dependencies (0)

                                                                    No peer dependencies.

                                                                    Badge

                                                                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/svgo.

                                                                    • Markdown
                                                                      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/svgo)
                                                                    • HTML
                                                                      <a href="https://www.jsdocs.io/package/@types/svgo"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>