Skip to content

Instantly share code, notes, and snippets.

@romannurik
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romannurik/4740b64eca76eb4539e1 to your computer and use it in GitHub Desktop.
Save romannurik/4740b64eca76eb4539e1 to your computer and use it in GitHub Desktop.
Quick script to make a folder of 24px SVGs from the downloadable material icons file.
#!/bin/sh
#
# 1. Download the file linked here:
# http://www.google.com/design/spec/resources/sticker-sheets-icons.html#sticker-sheets-icons-components
#
# 2. Run this:
# ./make_material_icon_svg_folder_for_iconjar.sh material-design-icons-1.0.1
#
DIR="$1"
if [ -z "$DIR" ]; then
echo "Usage: $0 <unzipped-material-icons-path>" >&2
exit
fi
OUTDIR="$1-out"
mkdir -p $OUTDIR
FOO=`find $DIR -iname \*.svg | grep 24px | grep production`
for f in $FOO; do
SECTION=`dirname $f | cut -d'/' -s -f2`
NAME=`basename $f`
NAME=${NAME//ic_/}
NAME=${NAME//_24px.svg/}
cat $f | sed -e 's/<\/svg>/<rect id="bounds" x="0" y="0" fill="none" width="24" height="24"\/><\/svg>/' > $OUTDIR/${NAME}_${SECTION}.svg
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment