#!/bin/sh # This script can be used to automatically export all project files # to ensure, they are a single path without any modifiers or other # inkscape-dependent things. It will also remove unnecessary things # from the SVGs. For this the script requires both inkscape and svgo # to be installed. for infile in ./project_files/*.svg do outfile="./$(basename "$infile")" inkscape --actions="select-by-element: svg; object-set-attribute: id, svg; select-clear; select-all: layers; selection-ungroup; select-clear; select-all: no-groups; object-stroke-to-path; path-union; object-set-attribute: id,path; object-set-attribute: style,; selection-group; selection-ungroup; export-plain-svg;" \ --export-filename "$outfile" \ --vacuum-defs "$infile" svgo --pretty "$outfile" done