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

Questions about calling "multipass" option #1330

Closed
wl879 opened this issue Feb 18, 2021 · 2 comments
Closed

Questions about calling "multipass" option #1330

wl879 opened this issue Feb 18, 2021 · 2 comments

Comments

@wl879
Copy link

wl879 commented Feb 18, 2021

The source code is in /lib/svgo.js:41

const optimize = (svgstr, config) => {
  ...
  const maxPassCount = config.multipass ? 10 : 1;
  ...
  for (let i = 0; i < maxPassCount; i += 1) {
    svgjs = svg2js(svgstr);   //  ⚠️ "svg2js" always using origin data "svgstr"
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ...
  }
  ...

I think, "svgstr" should be the last optimized data.

 for (let i = 0; i < maxPassCount; i += 1) {
    svgjs = svg2js(svgstr); 
    ....
    svgjs = js2svg(svgjs, config.js2svg);
    ...
    svgstr = svgjs.data
    ~~~~~~~~~
  }
@TrySound
Copy link
Member

TrySound commented Feb 18, 2021

Right, need to add tests. Thanks for catch!

TrySound added a commit that referenced this issue Feb 18, 2021
Ref
  #1330
  #1148
  #1133
  #1227
Took tests from #1177
TrySound added a commit that referenced this issue Feb 18, 2021
@TrySound
Copy link
Member

Fixed in 2.0.1

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

No branches or pull requests

2 participants