0

I have Node running on my machine v NVM and installed SVGO. The script runs and processes my files using the defaults.

However, I am trying to active the removeXMLNS plugin and cannot get the latest CLI script to pick up my customisation file.

I have created the js file below using the example from the github readme, however, it has no effect.

I also tried running the --config parameter and linked to my file, which is located at

~/Scrips/svg/svgo-optimise.js

I've found a lot of older articles but nothing on the latest version. I am hoping someone may have run into a similar issue.

module.exports = {
  plugins: [
    {
      name: 'preset-default',
      params: {
        overrides: {
          // customize default plugin options
          inlineStyles: {
            onlyMatchedOnce: false,
          },
          removeXLMNS: true,

          // or disable plugins
          removeDoctype: false,
        },
      },
    },
  ],
}; 

Thanks in advance

Penny Liu
  • 15,447
  • 5
  • 79
  • 98
Just Andy
  • 21
  • 4
  • typo? `removeXMLNS`, not `removeXLMNS`. – ccprog Aug 08 '23 at 14:18
  • Thanks, that was wrong but wasn't the final solution – Just Andy Aug 10 '23 at 16:12
  • Question: why ask Stackoverflow instead of posting an issue on the svgo issue tracker? If you can't figure out how to use it from the docs they've written, then a thousand other people can't either, and the best solution is to get the docs updated so that it covers this. – Mike 'Pomax' Kamermans Aug 18 '23 at 06:25

1 Answers1

0

You were correct.

However, after I made that change the script gave me a helpful error message and I solved the problem.

The additional plugins should have been added after the "extension" as I was adding them.

module.exports = {
  plugins: [
    {
      name: 'preset-default',
      params: {
        overrides: {
          // customize default plugin options
          inlineStyles: {
            onlyMatchedOnce: false,
          },

          // or disable plugins
          removeDoctype: false,
        },
      },
    },
// additional plugins here
    'removeXMLNS',
    {
      name: "addClassesToSVGElement",
      params: {
        className: "mySvg"
      }
    }
  ],
};
Just Andy
  • 21
  • 4