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

Can SVGO remove the xmlns attribute? #409

Closed
davewhitley opened this issue Jul 31, 2015 · 3 comments
Closed

Can SVGO remove the xmlns attribute? #409

davewhitley opened this issue Jul 31, 2015 · 3 comments

Comments

@davewhitley
Copy link

For example, this svg:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M22 16h-4V8c0-1.105-.895-2-2-2H8V2H6v4H2v2h4v8c0 1.105.895 2 2 2h8v4h2v-4h4v-2zM8 16V8h8v8H8z"/>
<path fill="none" d="M0 0h24v24H0z"/>
</svg>

would be converted to:

<svg viewBox="0 0 24 24">
<path d="M22 16h-4V8c0-1.105-.895-2-2-2H8V2H6v4H2v2h4v8c0 1.105.895 2 2 2h8v4h2v-4h4v-2zM8 16V8h8v8H8z"/>
<path fill="none" d="M0 0h24v24H0z"/>
</svg>

I tried looking through the documentation and couldn't find anything about the xmlns attribute. Thanks in advance.

@waldyrious
Copy link
Contributor

Ironically, the xmlns attribute is the only thing required to produce a valid svg file. See https://github.com/mathiasbynens/small/blob/master/svg.svg?short_path=5fda422 (or try validating the second code snippet as SVG in http://validator.nu)

@davewhitley
Copy link
Author

Thank you! I'll leave the attribute in.

@GreLI
Copy link
Member

GreLI commented Aug 4, 2015

You can write a simple plugin. When there are several SVGs inlined in HTML there is no real need to keep xmlns in each one.

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

3 participants