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

How to pass param to plugin through CLI #636

Closed
jkelstrup opened this issue Dec 19, 2016 · 5 comments
Closed

How to pass param to plugin through CLI #636

jkelstrup opened this issue Dec 19, 2016 · 5 comments

Comments

@jkelstrup
Copy link

I can't seem to figure out how to pass a param to a plugin when using the command line.

Specifically I want to tell convertColors to set currentColor to true.

The only way I found to do this is to create a config-file. But I'm hoping that there's a simpler inline-way of doing it?

@elrumordelaluz
Copy link
Contributor

@jkelstrup looking at the coa code seems that there's a way to pass a config String JSON formatted. Something like (tested and it works for me):

svgo -i test.svg -o test-out.svg --config '{ "plugins": [ { "convertColors": { "currentColor": true } }] }'

I think could be added into CLI helps.

@jkelstrup
Copy link
Author

Thanks a lot @elrumordelaluz ! This might not be the prettiest of CLI-interactions, but it does exactly what I was looking for!

I'm gonna close this issue. If others could find it useful to see this improved, I think a new issue should be opened for that.

@elrumordelaluz
Copy link
Contributor

yes @jkelstrup, absolutely agree about

might not be the prettiest

and

new issue should be opened for that.

@evilPaprika
Copy link

@elrumordelaluz
Inlined json config is no longer suppored in svgo@2. What should i do?

@TrySound
Copy link
Member

@evilPaprika Use svgo.config.js

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

4 participants