Advertisement


Svg sprite from Illustrator (with separate viewBox for each element)?


Question

Is there a way to export an .svg sprite directly from Illustrator, with a separate viewBox for each element?

I am only able get one viewBox for the whole set of icons, even when each of them is on its own artboard.

2016/07/06
1
3
7/6/2016 1:42:00 PM

I seem to have found the solution - each sprite element must be converted to a symbol. That creates a viewBox for each symbol when exporting the svg.

An example:

<symbol id="badminton" data-name="badminton" viewBox="0 0 33.84 40.41">
2016/07/06
4
7/6/2016 2:29:00 PM