Svgo: How to provide options to plugins via command line?

Created on 18 May 2015  路  2Comments  路  Source: svg/svgo

Hey,

I'm trying to use the "prefix" option of the cleanupIDs plugin:
https://github.com/svg/svgo/blob/master/plugins/cleanupIDs.js#L10

Apparently it's not stated anywhere on how to provide options to plugins like this.

How do I do it using a config file?
How do I do it using the command line?

Thanks.

Most helpful comment

So you need to provide your config in .yml file with content like this:

``` (yml)
plugins:

  • cleanupIDs:
    prefix: foo
and run svgo with it like

svgo --config=yourconfig.yml

You can also provide a config in a command line like json:

svgo --config='{ "plugins": [ { "cleanupIDs": { "prefix": "foo" } } ] }'
```

Note: cleanupIDs doesn't work with SVG files containing <style> or <script> since svgo can't parse them.

All 2 comments

See about config.

So you need to provide your config in .yml file with content like this:

``` (yml)
plugins:

  • cleanupIDs:
    prefix: foo
and run svgo with it like

svgo --config=yourconfig.yml

You can also provide a config in a command line like json:

svgo --config='{ "plugins": [ { "cleanupIDs": { "prefix": "foo" } } ] }'
```

Note: cleanupIDs doesn't work with SVG files containing <style> or <script> since svgo can't parse them.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pixelass picture pixelass  路  3Comments

onlymega picture onlymega  路  6Comments

elidupuis picture elidupuis  路  5Comments

niftylettuce picture niftylettuce  路  4Comments

guylando picture guylando  路  3Comments