-
Notifications
You must be signed in to change notification settings - Fork 109
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
Add support for SVGo 2.x #191
Comments
From the 2.x CLI: Usage: svgo [options] [INPUT...]
Nodejs-based tool for optimizing SVG vector graphics files
Arguments:
INPUT Alias to --input
Options:
[...]
--config <CONFIG> Config file or JSON string to extend or replace default
[...] So it seems that the plugins should be enabled/disabled in a JSON string passed to the |
As per the README, about JSON configuration, "If plugins field is specified default list is fully overrided". The other possibility would be to use a javascript configuration file to keep the default plugins, and create a json from scratch if file does not exist... which is, IMO, not optimal. |
Thanks for opening the issue. Checking release 2.0.0 there is a note about using |
|
Well... passing raw JSON in the CLI does nothing. SVGo ignores it: node_modules/.bin/svgo -i in.svg -o defaults.svg --pretty
node_modules/.bin/svgo -i in.svg -o out.svg --pretty --config="{floatPrecision:1}"
diff defaults.svg out.svg
# no difference
# With svgo.config.js and the same options
node_modules/.bin/svgo -i in.svg -o out.svg --pretty
diff defaults.svg out.svg
# lots of differences Passing raw javascript is silently ignored, as I thought: node_modules/.bin/svgo -i in.svg -o out.svg --pretty --config="module.exports={floatPrecision:1};"
diff defaults.svg out.svg
# no difference While not evaluating JS from |
They dropped support for inline JSON in '--config', it now only takes a JS file as argument. I guess we're stuck with v 1.3 for now, or specify a configuration file or have a |
You already saw that in 2.1.0 properly documents that config can be only a js file path. |
Version 2 has CLI changes, which makes it incompatible with
image_optim
. I have not dug into the code to see how the different versions can be handled, but for now, I can say that a call likeleaves the picture unchanged.
From the release notes:
The text was updated successfully, but these errors were encountered: