Skip to content

Need help getting a config to be passed through #7

Open
@mosesoak

Description

@mosesoak

Hi, we're trying to use this plugin on Gatsby 3 and having partial success.

Some parts of the config go through, e.g. 'prefixIds' (confirmed) and a custom plugin config (confirmed), but overriding preset-default params does not work correctly.

The syntax you show in your example in the README is wrong, maybe it was targeting a dated version of svgo. Even though gatsby can compile the app, the screen shows a warning about an unknown file type on an svg path.

Using the current syntax it should be more like this:

    {
      resolve: 'gatsby-plugin-svgr-svgo',
      options: {
        inlineSvgOptions: [
          {
            test: /\.svg$/,
            svgoConfig: {
              plugins: [
                'prefixIds',
                {
                  name: 'preset-default',
                  params: {
                    overrides: {
                      removeViewBox: false,
                    },
                  },
                },
              ],
            },
          },
        ],
      },
    },

However, viewBox is still being removed from inline SVGs by SVGO.

If you get this and can debug the problem, that would greatly help us out as we are currently grafting a known viewBox back onto an inline svg that needs it to display correctly in a live website.

(Would also suggest updating your README and getting Gatsby's page for your plugin updated once you get the new svgo syntax in there!)

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions