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

External JSON config file rootAttributes setting is ignored and causes error with command line tool #228

Closed
johnhelmuth opened this issue May 19, 2017 · 2 comments
Assignees
Labels
Milestone

Comments

@johnhelmuth
Copy link

When running the svn-sprite command line tool to generate our SVG sprite sheets, we are seeing the following error message:

[ERROR] Skipping --svg-rootattrs file due to errors ("Path must be a string. Received { preserveAspectRatio: 'none' }")

The tool generates a sprite sheet file, but the attributes are not added to the resulting file.

I can reproduce the error with this command line and the attached config file:

svg-sprite.js --css css-render-css --dest=out --config=./svg-sprite.json iconsets/*.svg

svn-sprite.json:
{ "svg": { "rootAttributes": { "preserveAspectRatio": "none" } }, "log": "info" }

This appears to be caused by the way that svg-sprite.js merges the config file settings (lines 166-197) with the command line settings returned from the yargs library (lines 158-163) and then assumes that the valid svg.rootAttributes value should be a string (line 207.)

If I have time this weekend I will try to prepare a PR to fix this.

@johnhelmuth
Copy link
Author

This may be a similar problem to these issues:

#162
#199

@jkphl jkphl self-assigned this May 30, 2017
@jkphl jkphl added the bug label May 30, 2017
@jkphl jkphl added this to the 1.3.x milestone May 30, 2017
@jkphl jkphl closed this as completed in 8b69215 Jun 1, 2017
@jkphl
Copy link
Collaborator

jkphl commented Jun 1, 2017

The problem was the internal handling of the rootAttributes option in CLI. It was expected to be a string (file path) even if it had already been set via an external config file. Should be fixed now. :)

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

No branches or pull requests

2 participants