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

Remove useless wrapping tags #419

Closed
nt1m opened this issue Sep 1, 2015 · 6 comments
Closed

Remove useless wrapping tags #419

nt1m opened this issue Sep 1, 2015 · 6 comments

Comments

@nt1m
Copy link

nt1m commented Sep 1, 2015

If a g tag only has one child, apply the styles and attributes on the child then remove the tag.

@nathanuphoff
Copy link

Furthermore, change translate="transform(10,10)" to x="10" y="10" (shorter). And better yet, (optionally) inline styles to style="properties:here" which is in anmost any case the shorter syntax. Cheers.

@GreLI
Copy link
Member

GreLI commented Sep 2, 2015

x and y work only on limited set of tags. style= adds 6 bytes by itself and can be compensated also by more than 6 rules, which is rare, actually.

@nathanuphoff
Copy link

Actually four is the threshold after which style becomes the more efficient option. Not worth it I would say: http://d.pr/i/1jB6A

I did not know about the x and y’s limitations in that regard. Thanks.

@nt1m
Copy link
Author

nt1m commented Sep 2, 2015

@nathanuphoff I think the W3C recommends inline attributes instead of inline styles. In fact, some CSS properties act differently than their SVG equivalents (transforms for example).

@nathanuphoff
Copy link

@nt1m Clear. I’m pretty fresh to svg outside Sketch.app until some things annoyed me and I had to take a look below the surface. Consider me a newbie to the matter. It’s like learning html all over again, including all the quirks.

@GreLI
Copy link
Member

GreLI commented Nov 19, 2016

Regarding the subject, collapseGroups plugin already does the job. Sometimes it can be missed because group is empty after later executed plugins, but the second run will optimize that. There's --multipass to run multiple times (10 times or until there's nothing can be optimized).

@GreLI GreLI closed this as completed Nov 19, 2016
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