Skip to content
This repository has been archived by the owner on Aug 24, 2019. It is now read-only.

Docs! #6

Open
lifeiscontent opened this issue Mar 18, 2018 · 1 comment
Open

Docs! #6

lifeiscontent opened this issue Mar 18, 2018 · 1 comment

Comments

@lifeiscontent
Copy link

lifeiscontent commented Mar 18, 2018

Hey @neoziro just started poking around in h2x. It's awesome. You guys are creating such cool stuff.

Anyway, I'd love to start building a few h2x plugins but I'm also not familiar with how the tree traversals work.

here's the first plugin I'm thinking:

given an SVG like this:

<svg width="18" height="18" viewBox="0 0 60 60" xmlns:xlink="http://www.w3.org/1999/xlink" fill="rgb(255,255,255)">
  <defs>
    <path d="M16 16h28v4H16v-4zm-6 12h40v4H10v-4zm6 12h28v4H16v-4z" id="a"></path>
  </defs>
  <use fill="#FFF" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#a" fill-rule="evenodd"></use>
</svg>

I'd like to check to see if there is only 1 reference to a<use> remove the element from defs and inline it.

@gregberge
Copy link
Member

Hmm yes, I think it is possible but I don't know how 😅.

I am very new to tree traversal and I wrote it several months ago, you will have to go deep in the code. Also it is inspired by Babel, so finding Babel plugin help could help you!

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

No branches or pull requests

2 participants