import shutil from pathlib import Path from subprocess import run # Compress all SVG files in a directory, recursively entering subdirectories. # This solution is necessary because SVGO lacks support for a '--recursive' option # (https://github.com/svg/svgo/pull/712), and other workarounds are platform-dependant. svgo = shutil.which("svgo") # https://stackoverflow.com/a/32799942/2203482 def compress(path): # Calling "svgo -f