Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need help getting a config to be passed through #7

Open
mosesoak opened this issue Feb 18, 2022 · 2 comments
Open

Need help getting a config to be passed through #7

mosesoak opened this issue Feb 18, 2022 · 2 comments

Comments

@mosesoak
Copy link

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!

@williamrenwick
Copy link

@mosesoak Did you manage to find a workaround to this? I'm having the exact same issue as you (trying to stop SVGO stripping the viewbox attr).

@samlogan
Copy link

samlogan commented Jan 3, 2023

I am also facing this issue. @mosesoak did you find a workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants