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 Answers 2

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.

3
  • That would be a solution, but I don't really like these kind of hacks Commented Oct 2, 2019 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
    Commented Oct 2, 2019 at 12:19
  • That sucks. I'll wait for a bit and then mark your answer as the correct one Commented Oct 2, 2019 at 14:30
2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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