h2x icon indicating copy to clipboard operation
h2x copied to clipboard

Docs!

Open lifeiscontent opened this issue 7 years ago • 1 comments

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.

lifeiscontent avatar Mar 18 '18 16:03 lifeiscontent

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!

gregberge avatar Mar 18 '18 16:03 gregberge