Skip to content

Instantly share code, notes, and snippets.

@santhoshtr
Created May 3, 2016 05:42
Show Gist options
  • Save santhoshtr/351a55fc52fbafd719510b636743b5b4 to your computer and use it in GitHub Desktop.
Save santhoshtr/351a55fc52fbafd719510b636743b5b4 to your computer and use it in GitHub Desktop.
ULS webfonts to woff2
fontInfos=$(find ../data -name 'font.ini')
#for f in $fontInfos; do sed -i -n 'p; s/woff/woff2/gp' $f; done
# Change to point to your fonts directory as needed
ttfs=$(find ../data -name '*.ttf')
# Create .woff2 versions of your ttf files
#for f in $ttfs; do woff2_compress $f || { echo "Fail on $f"; exit 1; }; done
woff2s=$(find ../data -name '*.woff2')
for f in $woff2s; do git add $f || { echo "Fail on $f"; exit 1; }; done
# Create a simple csv of { filename, ttf size, woff2 size }
ttfs=$(find ../data -name '*.ttf')
rm -f ttf_to_woff2.csv
for f in $ttfs; do \
echo "${f##*/}, $(du -h $f | awk '{print$1}'),$(du -h ${f%.ttf}.woff | awk '{print$1}'), $(du -h ${f%.ttf}.woff2 | awk '{print$1}')" >> ttf_to_woff2.csv;done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment