Skip to content

symbol are removed even when they're used in styles #1726

@nhoizey

Description

@nhoizey

Describe the bug

SVGO removes symbols from the SVG even when they're used in styles.

To Reproduce

With this SVG image: https://nicolas-hoizey.photo/ui/logo.svg

SVGO CLI with default configuration removes the <symbol>s, even if they're used in the styles, to make the logo responsive.

It doesn't remove the symbols with this configuration removing the inlineStyles plugin:

module.exports = {
  plugins: [
    {
      name: 'preset-default',
      params: {
        overrides: {
          inlineStyles: false,
        },
      },
    },
  ],
};

Expected behavior

symbols should be preserved, as they're useful in the image.

Desktop (please complete the following information):

  • SVGO Version 3.0.2
  • NodeJs Version 19.0.1
  • OS: macOS 13.0.1

Additional context

I tried first to optimize my SVG in SVGOMG and got the issue, which I referenced here:
jakearchibald/svgomg#417

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions