Skip to content

Instantly share code, notes, and snippets.

@bomberstudios bomberstudios/svgmin.sh
Last active Feb 23, 2016

Embed
What would you like to do?
A script to minimize Sketch's exported SVG files safely, using SVGO
# Cleanup SVG files exported from Sketch
# Needs SVGO (install by running 'npm install -g svgo')
if [[ -d $1 ]]; then
svgo -f $1 --pretty --disable=convertShapeToPath --enable=removeTitle --enable=removeDesc --enable=removeDoctype --enable=removeEmptyAttrs --enable=removeUnknownsAndDefaults --enable=removeUnusedNS --enable=removeEditorsNSData
elif [[ -f $1 ]]; then
svgo -i $1 --pretty --disable=convertShapeToPath --enable=removeTitle --enable=removeDesc --enable=removeDoctype --enable=removeEmptyAttrs --enable=removeUnknownsAndDefaults --enable=removeUnusedNS --enable=removeEditorsNSData
else
echo "Usage: svgmin <file> or svgmin <folder>"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.