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

CLI ignores --svg-namespace-ids false #763

Open
michaelbragg opened this issue Nov 17, 2022 · 8 comments
Open

CLI ignores --svg-namespace-ids false #763

michaelbragg opened this issue Nov 17, 2022 · 8 comments

Comments

@michaelbragg
Copy link

Overview:

Upgrading from 2.0.1 to 2.0.2 has broken the --svg-namespace-ids false command when using the CLI.

Our SVG Sprite builds, with 2.0.2, have started to include the full path as a namespace in the sprite file. Whereas 2.0.1 only included the filename as the ID.

On the command-line run svg-sprite -s --symbol-dest /assets/svg --svg-namespace-classnames false --svg-namespace-ids false --symbol-sprite icons.svg /assets/svg/icons/*.svg.

Original icon./assets/svg/icons/search.svg

<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M23.6719 20.7516L18.9984 16.0781C18.7875 15.8672 18.5016 15.75 18.2016 15.75H17.4375C18.7312 14.0953 19.5 12.0141 19.5 9.75C19.5 4.36406 15.1359 0 9.75 0C4.36406 0 0 4.36406 0 9.75C0 15.1359 4.36406 19.5 9.75 19.5C12.0141 19.5 14.0953 18.7313 15.75 17.4375V18.2016C15.75 18.5016 15.8672 18.7875 16.0781 18.9984L20.7516 23.6719C21.1922 24.1125 21.9047 24.1125 22.3406 23.6719L23.6672 22.3453C24.1078 21.9047 24.1078 21.1922 23.6719 20.7516ZM9.75 15.75C6.43594 15.75 3.75 13.0688 3.75 9.75C3.75 6.43594 6.43125 3.75 9.75 3.75C13.0641 3.75 15.75 6.43125 15.75 9.75C15.75 13.0641 13.0687 15.75 9.75 15.75Z"/>
</svg>

Expected Id value, as of 2.0.1, id="search":

<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><symbol viewBox="0 0 24 24" id="search" xmlns="http://www.w3.org/2000/svg"><path d="m23.672 20.752-4.674-4.674a1.124 1.124 0 0 0-.796-.328h-.765a9.703 9.703 0 0 0 2.063-6A9.749 9.749 0 0 0 9.75 0 9.749 9.749 0 0 0 0 9.75a9.749 9.749 0 0 0 9.75 9.75 9.702 9.702 0 0 0 6-2.063v.765c0 .3.117.585.328.796l4.674 4.674c.44.44 1.153.44 1.589 0l1.326-1.327c.44-.44.44-1.153.005-1.593ZM9.75 15.75c-3.314 0-6-2.681-6-6 0-3.314 2.681-6 6-6 3.314 0 6 2.681 6 6 0 3.314-2.681 6-6 6Z"/></symbol></svg>

Actual Id value, as of 2.0.2, id="public--app--themes--demo--assets--svg--icons--search":

<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><symbol viewBox="0 0 24 24" id="public--app--themes--demo--assets--svg--icons--search" xmlns="http://www.w3.org/2000/svg"><path d="m23.672 20.752-4.674-4.674a1.124 1.124 0 0 0-.796-.328h-.765a9.703 9.703 0 0 0 2.063-6A9.749 9.749 0 0 0 9.75 0 9.749 9.749 0 0 0 0 9.75a9.749 9.749 0 0 0 9.75 9.75 9.702 9.702 0 0 0 6-2.063v.765c0 .3.117.585.328.796l4.674 4.674c.44.44 1.153.44 1.589 0l1.326-1.327c.44-.44.44-1.153.005-1.593ZM9.75 15.75c-3.314 0-6-2.681-6-6 0-3.314 2.681-6 6-6 3.314 0 6 2.681 6 6 0 3.314-2.681 6-6 6Z"/></symbol></svg>

Resolving the issue can be achieved by rolling back SVG-Sprite to v2.0.1

@XhmikosR
Copy link
Member

Unsure how to proceed here because the changes in v2.0.2 were meant to fix another issue. Feel free to submit a PR with a test case.

michaelbragg added a commit to vatu-team/theme-build that referenced this issue Jan 13, 2023
@XhmikosR
Copy link
Member

@Kreeg it seems this is also a regression, unsure how ti fix it. If you have any ideas let me know.

@Kreeg
Copy link
Member

Kreeg commented Apr 15, 2023

I'll take a look in next week

@Kreeg
Copy link
Member

Kreeg commented Apr 15, 2023

That's strange, I can't confirm this on the latest version
svg-sprite.js -l info ~/projects/svg-sprite/test/fixture/svg/css/*.svg --css --svg-namespace-classnames false --svg-namespace-ids false --symbol-sprite icons.svg just did OK, with no full path included

@Kreeg
Copy link
Member

Kreeg commented Apr 15, 2023

I can't confirm this in 2.0.2. Ids are fine

svg-sprite -s ~/projects/svg-sprite/test/fixture/svg/css/*.svg --svg-namespace-classnames false --svg-namespace-ids false --symbol-sprite icons.svg -l info

2.0.1 is the same.
@XhmikosR can you confirm this bug?

@dmpinder
Copy link

Can confirm I'm getting the same result as @michaelbragg.

I'm using 2.0.2, and this command:

"svg-test": "svg-sprite -s ./public/app/themes/theme/assets/svg/icons/*.svg --svg-namespace-classnames false --svg-namespace-ids false --symbol-sprite icons.svg --symbol-dest ./public/app/themes/theme/assets/svg",

It then outputs this:

<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><symbol viewBox="0 0 55 40" id="public--app--themes--theme--assets--svg--icons--aeo" xmlns="http://www.w3.org/2000/svg"><path d="M32.909 17.594a12.534...

Whereas if using 2.0.1, it outputs this, which is the desired behaviour:

<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><symbol viewBox="0 0 55 40" id="aeo" xmlns="http://www.w3.org/2000/svg"><path d="M32.909 17.594a12.534...

@chimok
Copy link

chimok commented Oct 6, 2023

@XhmikosR Why are you unsure? Simply revert the change and it would be really nice to care more about semver so it won't break our builds.

@dmpinder
Copy link

dmpinder commented Mar 4, 2024

Hi folks, has there been any update on this? I noticed 2.0.3 has been released, but if there's an ETA on this fix that would be appreciated, as we're currently having to fix the version number until it's resolved. Thanks!

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

No branches or pull requests

5 participants