Last active
March 23, 2018 16:28
-
-
Save hudri/49498b68606bb6c1626e67f720867db5 to your computer and use it in GitHub Desktop.
Turn FontAwesome5 raw <svg>s into <symbol>s
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
cd advanced-options/raw-svg/regular | |
# prefix filenames with 'far-' so we could mix icons from different style set | |
rename 's/^/far-/' *.svg | |
# change opening tag '<svg xmlsn="http://www.w3.org/2000/svg"' into ' <symbol id="current-filename.svg"' | |
perl -i -pe 's/<svg xmlns="http:\/\/www.w3.org\/2000\/svg"/ <symbol id="$ARGV"/g' *.svg | |
# remove the trailng '.svg' from the id | |
perl -i -pe 's/\.svg"/"/g' *.svg | |
# change closing tag from '</svg>' to '</symbol>' | |
perl -i -pe 's/<\/svg>/<\/symbol>/g' *.svg | |
# go into next style directory, repeat with different filename prefix | |
# copy&paste content of selected SVGs into HTML document |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Turn Font Awesome 5 raw SVGs into symbols so we can include them into HTML documents. Inlined SVGs can be styled with CSS (including hover effects).