Last active
February 9, 2017 19:10
-
-
Save iarry/e7dbe46edab4f4e84db9ddf53f1a458c to your computer and use it in GitHub Desktop.
Optimizes SVG with SVGO, then strips it from all classes, ids, viewbox, removes the style tag, and replaces the svg tag with a g tag to be used within our Icon component. Also deletes the sed backup.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
original=$1 | |
svgo $original | |
sed -i '.svg' 's/<style>[^<]*<\/style>//g; ;s/class="[^"]*" //g; s/ viewBox="[^"]*"//g; s/<svg/<g/g; s/<\/svg>/<\/g>/g; s/id="[^"]*" //g; s/ xmlns="[^"]*"//g' $original | |
rm $original.svg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment