larsenwork / web.svg.min

Vector icons, badges, flags etc. über optimised for web use.
384 stars 31 forks source link

Consider trimming whitespace #7

Open alecmev opened 8 years ago

alecmev commented 8 years ago

Not sure how others use SVG assets, but in my case, I had to trim the whitespace myself, so that the width / height of an image would correspond to the same width / height of its contents. Handy way to trim the whitespace is to just open an SVG image in any browser, run this in the console:

const x = document.getElementsByTagName("svg")[0].getBBox();
console.log(`${x.x} ${x.y} ${x.width} ${x.height}`);

And copy the output into viewBox attribute of the SVG tag.

larsenwork commented 8 years ago

I've added the whitespace by design because then I get consistent layout of icons but it could prolly be a good idea to remove it to be more flexible in terms of use cases.