Skip to content

Instantly share code, notes, and snippets.

@kyleknighted
Created August 21, 2018 14:26
Show Gist options
  • Save kyleknighted/f9fa682aa30fb5f739f5d6bdda12b562 to your computer and use it in GitHub Desktop.
Save kyleknighted/f9fa682aa30fb5f739f5d6bdda12b562 to your computer and use it in GitHub Desktop.
Automating SVG Icon Management with Sketch and Makefiles
#!/usr/bin/env sh
readme=./src/assets/README.md
echo -n > $readme # clears or creates empty file
echo "# Icons" >> $readme # h1 title of README document
echo "| preview | name |" >> $readme # column names for table
echo "|:----:| ---- |" >> $readme # center align preview image and left align name
# loop through all icons
for filename in src/assets/icons/*.svg ; do \
# get filename of icon without path or ".svg" extension
icon=$(basename $filename .svg) ; \
# build the row in the table
echo "|<img src=\"icons/$icon.svg\" alt=\"$icon\" width=\"24px\"/>|$icon|" >> $readme ; \
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment