How to exclude hidden shapes when saving to SVG
Im trying to save icons out to SVG format, one at a time, but from one document. what i mean is, i have all my icons laid out in one document, and once i am ready to save them, i will move the icon i need to save to the artboard, hide everything else and save to .svg.
The problem is that opening the .svg file reveals that even if the graphic is shown as saved (correct whitespace/square, only one visible icon) -the code in the svg file contains every single element from my AI file (with the added display="none") - How can i make sure that everything that is hidden is not saved? is it even possible? Ofc i can just copy the icon i want to save to a new AI file and save that, but flipping between files and re-aligning icons to a new artbaord is tedious, prone to error and straight up sucks.
I copy and paste only the paths I want in the SVG to a newly created art board and save to SVG from there.
I sometimes use the Pathfinder to optimise further after pasting.
Before using Pathfinder, all paths should be fully expanded.