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

error: unknown option #1356

Open
JoKalliauer opened this issue Feb 21, 2021 · 7 comments · May be fixed by #1977
Open

error: unknown option #1356

JoKalliauer opened this issue Feb 21, 2021 · 7 comments · May be fixed by #1977

Comments

@JoKalliauer
Copy link

I used an old version of SVGO like e.g. comand

svgo -i input.svg -o output.svg --pretty --indent=1 -p 3 --enable=removeHiddenElems --disable=removeUnknownsAndDefaults

and I got error: unknown option '--enable=removeHiddenElems'

However it seems svgo is not backwards compatible.

I have read #1329 and #1337/files, and do not understand what to do.

I have tried to copy svgo.config.js from #1329 (comment) into the current folder and got

Error: Cannot find module 'svgo'
Require stack:
- /home/jkalliau/Documents/GitHub/cleanupSVG/svgo.config.js
- /home/jkalliau/prgm/node-v15.4.0-linux-x64/lib/node_modules/svgo/lib/svgo-node.js
- /home/jkalliau/prgm/node-v15.4.0-linux-x64/lib/node_modules/svgo/lib/svgo/coa.js
- /home/jkalliau/prgm/node-v15.4.0-linux-x64/lib/node_modules/svgo/bin/svgo
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/home/jkalliau/Documents/GitHub/cleanupSVG/svgo.config.js:3:34)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:997:19)
@TrySound
Copy link
Member

Hi. You need to install svgo locally like this npm i svgo

@XhmikosR
Copy link
Contributor

@TrySound I'd say we need the CLI README.md examples to show how to disable/enable plugins too :)

@TrySound
Copy link
Member

Only possible with config for now

@adl
Copy link

adl commented Feb 21, 2021

Came here for a similar reason: after my weekly update I had a lot of CI builds failing with error: unknown option '--disable=removeViewBox'.

The releases notes for 2.0.0 suggests that --disable/--enable might be reimplemented in a later version, so I'll simply stick to svgo@1.3.2 in the meantime. The amount of configuration needed in 2.0.0 to simply disable one plugin seems a bit overkill in my case.

@evenfrost
Copy link

Came here because of this as well. Looks like there is no way to use svgo if I just want to use it as a CLI program (without e.g. polluting local scope with node_modules created from npm i svgo). It's probably better to remove CLI usage at all then as it's so limited now.

@DabeDotCom
Copy link

Let me preface this by saying I do admire and appreciate the team's decision to, as a wise famous man once said: "Move Fast and Break Things"

However... I, too, was just bitten by the removal of the --enable=PLUGIN CLI argument. :-(

I would vote that this issue be reopened, lest people inadvertently start creating duplicates. (I almost did!)

@JoKalliauer
Copy link
Author

I would like the reimplementation of --enable=PLUGIN-feature. (maybe I switch back to the buggy 1.3.2-version)

I had closed the issue, since I was able to solve the error, not meaning I'm anyhow happy with the solution/workaround.

Imho this bug-report/question is solved, but we should file a new feature-request. Since I do not know any duplicate/feature-request I reopen this issue for now, however it is up to the svgo-mebers how to proceed.

@JoKalliauer JoKalliauer reopened this Jun 17, 2021
wojtekmaj added a commit to wojtekmaj/svgo that referenced this issue Apr 8, 2024
Closes svg#1356
Closes svg#1622

In svg#1622 (comment) we read:

> I consider adding it back at some point but it should be able to work with presets somehow. This is still need to be figured out.

I believe that adding it at the very last possible moment, AFTER initial list is resolved, will make it work with presets, and preserve the original behavior if the options aren't used at all.

I've also increased JSDoc coverage here, mainly for my own sanity when working with these arrays of plugins. Hope you don't mind that scope creep :)
wojtekmaj added a commit to wojtekmaj/svgo that referenced this issue Apr 8, 2024
Closes svg#1356
Closes svg#1622

In svg#1622 (comment) we read:

> I consider adding it back at some point but it should be able to work with presets somehow. This is still need to be figured out.

I believe that adding it at the very last possible moment, AFTER initial list is resolved, will make it work with presets, and preserve the original behavior if the options aren't used at all.

I've also increased JSDoc coverage here, mainly for my own sanity when working with these arrays of plugins. Hope you don't mind that scope creep :)
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

Successfully merging a pull request may close this issue.

6 participants