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

How to apply SVGO plugins #9

Open
mikeriley131 opened this issue Nov 10, 2023 · 2 comments
Open

How to apply SVGO plugins #9

mikeriley131 opened this issue Nov 10, 2023 · 2 comments

Comments

@mikeriley131
Copy link

I'm trying to get this to take SVGO plugins like this:

// rollup.config.js

const config = {
  ...,
  plugins: [
    svgSprite({
      outputFolder: './build,
      plugins: [
        'preset-default',
        {
          name: 'addAttributesToSVGElement',
          params: {
            attributes: [
              { 'fill-rule': 'currentColor' },
              { 'aria-hidden': 'true' },
              { role: 'presentation' },
            ]
          }
        }
      ]
    })
  ]
}

But I am not seeing the plugins take effect in the generated sprite sheet.
Am I doing this incorrectly?

Thanks.

@vladshcherbin
Copy link
Owner

@mikeriley131 Hey 👋

You're absolutely right in your config, however this package was created when SVGO was at version 1 and now it's version 3. The configuration in new versions was changed and that's why it's not working correctly.

Here's how it was in 1.3.2 - https://github.com/svg/svgo/blob/v1.3.2/examples/test.js

Since I'm not using rollup for the past few years the best thing would probably be this package deprecation.

Sorry

@mikeriley131
Copy link
Author

OK, thanks for letting me know.

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

2 participants