-
Notifications
You must be signed in to change notification settings - Fork 45
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
How to import SVG shapes through ShapePath? #86
Comments
For converting an SVG path to Sketch's points, there is no converter built to handle that (at least not in this library). Building one, I think, would be relatively straightforward though. For you second point, placing raw Sketch JSON into a model class like ShapePath, you will need to pass it in as the 2nd argument. The model constructors are written such that the first argument is used if you are generating a model in code like:
If you are passing through raw Sketch JSON like above you would do:
This is so that building models in JS is easier than writing raw Sketch JSON by hand, but if you have are starting with an existing Sketch file, it will instantiate the classes with the raw JSON. Hope that helps! Let me know if you have any other questions. |
Hi there! |
Similar to @eeegor we have a bunch of (~400) svgs that I'd like to bring into a sketch library file. However I'm hitting issues in trying to determine how to get the svg data into the appropriate points format. For instance
So far I've tried 'svg-points' and 'wilderness-dom-node', and when I import the points they provide into sketch I'm finding it just crashes sketch.
@L2jLiga Are you able to show how you're using paper, looking through the documentation I'm not seeing how! :) @dbanksdesign You said a converter to Sketch's point should be relatively forward. Can you provide any pointers? |
Please have a look here: https://github.com/telekom/scale/tree/main/packages/generator-sketch a while ago my team build a sketch generator which parses the svgs into sketch. It’s not straightforward at all, quite some heavy lifting. Should be somewhere in the repo 🙂 |
I'm trying to import an
svg
file withShapePath
and was wondering how this is working.What's the way to convert a
svg path
topoints
?When reading a
Sketch
file with asvg
inside the point structure looks like this:When I place this within
new ShapePath({...the example goes here})
I get the shape intoSketch
but the frame size is0,0
, so when I manually resize it to128, 54
, and give it afill
color it appears to be correct.The background is that I have a collection of
svg
icons I would like to place on anArtboard
, so I'm looking for a way to automatically convert all files into the proper format.Thanks!
The text was updated successfully, but these errors were encountered: