Skip to content

Instantly share code, notes, and snippets.

@izifortune
Created November 20, 2015 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save izifortune/211cb1339b919e5dde7a to your computer and use it in GitHub Desktop.
Save izifortune/211cb1339b919e5dde7a to your computer and use it in GitHub Desktop.
import glob
import os
data = {}
cnt = 1
files = glob.glob("*.svg")
for f in files:
d = open(f, 'r')
content = d.readlines()
svg = []
for el in content:
svg.append('//' + el)
tmp = "//" + f + "\n//\n" + "//Markup:" + "\n" + "//<core-icon icon-id=\"icons.glyphs." + \
f.replace('.svg', '') + "\">\n//<!-- IGNORE -->\n//<div>\n" + \
''.join(svg) + "//</div>\n//<!-- ENDIGNORE -->\n//</core-icon>" + "\n//\n//Style guide 5.1." + str(cnt) + "\n"
data[f] = tmp
cnt += 1
with open("testing.less", "a") as f:
for i in data:
f.write(data[i] + "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment