0

When I export an icon as an .svg that contains padding, the padding seems to get lost when saved.

I have this icon with a 1px padding on the sides: enter image description here

When I export that icon as a .svg, and import it again, it has lost it's padding. How do I preserve this?

Extra information: I'm using the SVGO compressor plugin to compress .svg's

2

Not sure what the compressor does exactly, but one simple way would be adding a transparent rectangle to the artboard that covers the whole area.

| improve this answer | |
  • That would be a solution, but I don't really like these kind of hacks – Gerlof Leuhof Oct 2 '19 at 8:54
  • Sketch (unlike Adobe Illustrator, Affinity Designer or Inkscape) doesn't respect the viewBox size as artboard. It imports the inner SVG content only. So this hack is the only option I know of. – AAGD Oct 2 '19 at 12:19
  • That sucks. I'll wait for a bit and then mark your answer as the correct one – Gerlof Leuhof Oct 2 '19 at 14:30
1

Add your icon on a new artboard of your desired size, and export the artboard itself as SVG. This works for me.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.