source: trunk/html5/build/skin-builder.py @ 982

Revision 982, 832 bytes checked in by zach, 3 years ago (diff)
  • Adding default skin (non-working)
  • Modified logging for debugger
Line 
1import base64
2from xml.dom import minidom
3
4basePath = "../assets"
5skinName = "five"
6skinPath = basePath + "/" + skinName + "/" + skinName + ".xml"
7skinFile = open(skinPath,"r")
8skin = minidom.parse(skinFile)
9components = skin.getElementsByTagName('component')
10for component in components:
11        componentName = component.attributes["name"]
12        elements = component.getElementsByTagName('element')
13        for element in elements:
14                elementPath = basePath + "/" + skinName + "/" + componentName.value + "/" + element.attributes['src'].value
15                imageText = base64.b64encode(open(elementPath,"rb").read())
16                element.attributes['src'].value = "url('data:image/png;base64," + imageText+ "')"
17outputPath = skinPath = basePath + "/" + skinName + "/" + skinName + "-min.xml"
18outputFile = open(skinPath,"w")
19outputFile.write(skin.toxml())
20outputFile.close()
Note: See TracBrowser for help on using the repository browser.