Generate gzip for frontend/mdi

This commit is contained in:
Paulus Schoutsen 2016-05-15 16:38:05 -07:00
parent de5533e3c2
commit e4b697b1ed
6 changed files with 9 additions and 2 deletions

View file

@ -1,2 +1,2 @@
"""DO NOT MODIFY. Auto-generated by update_mdi script."""
VERSION = "1baebe8155deb447230866d7ae854bd9"
VERSION = "9ee3d4466a65bef35c2c8974e91b37c0"

File diff suppressed because one or more lines are too long

View file

@ -8,6 +8,7 @@ npm run frontend_prod
cp bower_components/webcomponentsjs/webcomponents-lite.min.js ..
cp build/frontend.html ..
cp build/service_worker.js ..
gzip build/frontend.html -c -k -9 > ../frontend.html.gz
# Generate the MD5 hash of the new frontend
cd ../..

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python3
"""Download the latest Polymer v1 iconset for materialdesignicons.com."""
import hashlib
import gzip
import os
import re
import requests
@ -16,6 +17,7 @@ CUR_VERSION = re.compile(r'VERSION = "([A-Za-z0-9]{32})"')
OUTPUT_BASE = os.path.join('homeassistant', 'components', 'frontend')
VERSION_OUTPUT = os.path.join(OUTPUT_BASE, 'mdi_version.py')
ICONSET_OUTPUT = os.path.join(OUTPUT_BASE, 'www_static', 'mdi.html')
ICONSET_OUTPUT_GZ = os.path.join(OUTPUT_BASE, 'www_static', 'mdi.html.gz')
def get_local_version():
@ -58,6 +60,10 @@ def write_component(version, source):
print('Writing icons to', ICONSET_OUTPUT)
outp.write(source)
with gzip.open(ICONSET_OUTPUT_GZ, 'wb') as outp:
print('Writing icons gz to', ICONSET_OUTPUT_GZ)
outp.write(source.encode('utf-8'))
with open(VERSION_OUTPUT, 'w') as outp:
print('Generating version file', VERSION_OUTPUT)
outp.write(