Last active
December 17, 2015 21:49
-
-
Save mfr/5677238 to your computer and use it in GitHub Desktop.
embed woff files
This file contains hidden or 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 | |
for f in *.css; do | |
grep -ioE "(url\(|src=)['\"]?[^)'\"]*" $f | grep -ioE "[^\"'(]*.\.(woff)" | while read l ; do | |
sed -i "s>$l>data:font/${l/[^.]*./};base64,`openssl enc -base64 -in $l| tr -d '\n'`>" $f ; | |
done; | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment