Only process .svg files. Fix #4
This commit is contained in:
parent
13dab1a982
commit
de4bbf9700
@ -5,6 +5,8 @@ ICON_SIZE = 1024
|
|||||||
def make_file(directory, name, out):
|
def make_file(directory, name, out):
|
||||||
out.write('<ha-iconset-svg name="{}" size="{}"><svg><defs>\n'.format(name, ICON_SIZE))
|
out.write('<ha-iconset-svg name="{}" size="{}"><svg><defs>\n'.format(name, ICON_SIZE))
|
||||||
for f in os.listdir(directory):
|
for f in os.listdir(directory):
|
||||||
|
if not f.endswith('.svg'):
|
||||||
|
continue
|
||||||
with open(os.path.join(directory, f), 'r') as fp:
|
with open(os.path.join(directory, f), 'r') as fp:
|
||||||
name = os.path.splitext(f)[0]
|
name = os.path.splitext(f)[0]
|
||||||
data = fp.read()
|
data = fp.read()
|
||||||
@ -18,7 +20,7 @@ def make_file(directory, name, out):
|
|||||||
out.write('<g id="{0}" transform="scale({1} {1})">'.format(name, 1/scale) + data[start:-6] + '</g>\n')
|
out.write('<g id="{0}" transform="scale({1} {1})">'.format(name, 1/scale) + data[start:-6] + '</g>\n')
|
||||||
out.write('</defs></svg></ha-iconset-svg>')
|
out.write('</defs></svg></ha-iconset-svg>')
|
||||||
|
|
||||||
# Run this in Font-Awesome/advanced-options/raw-svg/
|
# Run this in Font-Awesome/svgs
|
||||||
|
|
||||||
# with open("hass-fontawesome-brands.html", 'w') as out:
|
# with open("hass-fontawesome-brands.html", 'w') as out:
|
||||||
# make_file('brands', 'fab', out)
|
# make_file('brands', 'fab', out)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user