30 lines
626 B
Python
Executable File
30 lines
626 B
Python
Executable File
#!/usr/bin/python3
|
|
#
|
|
# Minify Font Awesome js.all
|
|
#
|
|
# Remove all unused icons
|
|
#
|
|
# Pass a list of icon names (remove the "fa-" prefix), comma separated
|
|
#
|
|
# Usage example: minify-fa-js.py home,address-card
|
|
#
|
|
# Reads from STDIN, writes to STDOUT
|
|
#
|
|
import sys
|
|
import re
|
|
|
|
if len(sys.argv) < 2:
|
|
print("Usage (example): minify-fa-js.py home,address-card")
|
|
sys.exit(1)
|
|
|
|
fontnames = sys.argv[1].split(",")
|
|
|
|
for line in sys.stdin:
|
|
if re.search(r"\"[0-9a-z-]+\": \[", line):
|
|
for fontname in fontnames:
|
|
ss = '"'+fontname+'": ['
|
|
if ss in line:
|
|
print(line),
|
|
else:
|
|
print(line),
|