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

SVGO does not process files from local npm package #989

Open
movie4 opened this issue Jan 15, 2025 · 0 comments
Open

SVGO does not process files from local npm package #989

movie4 opened this issue Jan 15, 2025 · 0 comments

Comments

@movie4
Copy link

movie4 commented Jan 15, 2025

Hello!

When installing a package locally (npm link @package-name), files are not processed by SVGO.

We use custom plugin to console list of files

export default {
  svgoConfig: {
    plugins: [
      {
        name: 'preset-default',
      },
      {
        name: 'removeAttrs',
        params: { attrs: '(fill|stroke|stroke-width)' },
      },
      {
        name: 'addAttributesToSVGElement',
        params: {
          attributes: [{ fill: 'none' }, { stroke: 'none' }],
        },
      },
      {
        name: 'customPlugin',
        params: {
          paramName: 'paramValue',
        },
        fn: (ast, params, info) => {
          console.log(info)
        },
      },
    ],
  },
}

console.log(info) — displays only files that are in the src folder of the project

But if you install the package directly via npm (npm install @package-name) everything will work.

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

1 participant