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

Is it possible to create multiple sets of SVG sprites with different options? #96

Open
nat-davydova opened this issue Oct 1, 2023 · 1 comment

Comments

@nat-davydova
Copy link

I want to get 2 sets of sprites with different SVGO options.

If I do like this, only the first configuration is applied. What should I do to make both work?

import path from "path";

import { createSvgIconsPlugin } from "vite-plugin-svg-icons";

export default () => {
  return {
    plugins: [
      createSvgIconsPlugin({
        // Specify the icon folder to be cached
        iconDirs: [path.resolve(process.cwd(), "src/assets/icons/colored")],
        // Specify symbolId format
        symbolId: "icon-colored-[name]",

        /**
         * custom dom id
         * @default: __svg__icons__dom__
         */
        customDomId: "__svg__icons__colored__dom__",
        svgoOptions: {
          plugins: [
            {
              name: "removeAttrs",
              params: { attrs: ["width", "height"] },
            },
          ],
        },
      }),

      createSvgIconsPlugin({
        // Specify the icon folder to be cached
        iconDirs: [path.resolve(process.cwd(), "src/assets/icons/solid")],
        // Specify symbolId format
        symbolId: "icon-solid-[name]",

        /**
         * custom dom id
         * @default: __svg__icons__dom__
         */
        customDomId: "__svg__icons__solid__dom__",
        svgoOptions: {
          plugins: [
            {
              name: "removeAttrs",
              params: { attrs: ["width", "height", "fill", "stroke"] },
            },
          ],
        },
      }),
    ],
  };
};
@heavenly-zy
Copy link

heavenly-zy commented Nov 19, 2024

I have the same problem, have you solved it yet?

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