Browse Source

Merge pull request #358 from DanielR92/convert_py

Update convert py
pull/359/head
lumapu 2 years ago
committed by GitHub
parent
commit
940ea99e25
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      tools/esp8266/html/convert.py

24
tools/esp8266/html/convert.py

@ -1,6 +1,7 @@
import re
import os
import gzip
import glob
from pathlib import Path
@ -62,10 +63,19 @@ def convert2Header(inFile, compress):
f.write("#endif /*__{}_{}_H__*/\n".format(define, define2))
f.close()
convert2Header("index.html", True)
convert2Header("setup.html", True)
convert2Header("visualization.html", True)
convert2Header("update.html", True)
convert2Header("serial.html", True)
convert2Header("style.css", True)
convert2Header("api.js", True)
# delete all files in the 'h' dir, but ignore 'favicon_ico_gz.h'
dir = './html/h'
for f in os.listdir(dir):
if not f.startswith('favicon_ico_gz'):
os.remove(os.path.join(dir, f))
# grab all files with following extensions
os.chdir('./html')
types = ('*.html', '*.css', '*.js') # the tuple of file types
files_grabbed = []
for files in types:
files_grabbed.extend(glob.glob(files))
# go throw the array
for val in files_grabbed:
convert2Header(val, True)
Loading…
Cancel
Save