Fix build and minify html and js
This commit is contained in:
parent
425a0efeca
commit
15fe386457
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
.. module:: hashlib
|
.. module:: hashlib
|
||||||
:synopsis: hashing algorithms
|
:synopsis: hashing algorithms
|
||||||
|
:noindex:
|
||||||
|
|
||||||
|see_cpython_module| :mod:`cpython:hashlib`.
|
|see_cpython_module| :mod:`cpython:hashlib`.
|
||||||
|
|
||||||
|
|
|
@ -26,3 +26,7 @@ pyelftools
|
||||||
|
|
||||||
# for stubs and annotations
|
# for stubs and annotations
|
||||||
adafruit-circuitpython-typing
|
adafruit-circuitpython-typing
|
||||||
|
|
||||||
|
# for web workflow minify
|
||||||
|
minify_html
|
||||||
|
jsmin
|
||||||
|
|
|
@ -26,6 +26,9 @@
|
||||||
|
|
||||||
#include "supervisor/shared/web_workflow/websocket.h"
|
#include "supervisor/shared/web_workflow/websocket.h"
|
||||||
|
|
||||||
|
// TODO: Remove ESP specific stuff. For now, it is useful as we refine the server.
|
||||||
|
#include "esp_log.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
socketpool_socket_obj_t socket;
|
socketpool_socket_obj_t socket;
|
||||||
uint8_t opcode;
|
uint8_t opcode;
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import gzip
|
import gzip
|
||||||
|
import minify_html
|
||||||
|
import jsmin
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
|
@ -24,6 +26,10 @@ for f in args.files:
|
||||||
variable = path.name.replace(".", "_")
|
variable = path.name.replace(".", "_")
|
||||||
uncompressed = f.read()
|
uncompressed = f.read()
|
||||||
ulen = len(uncompressed)
|
ulen = len(uncompressed)
|
||||||
|
if f.name.endswith(".html"):
|
||||||
|
uncompressed = minify_html.minify(uncompressed.decode("utf-8")).encode("utf-8")
|
||||||
|
elif f.name.endswith(".js"):
|
||||||
|
uncompressed = jsmin.jsmin(uncompressed.decode("utf-8")).encode("utf-8")
|
||||||
compressed = gzip.compress(uncompressed)
|
compressed = gzip.compress(uncompressed)
|
||||||
clen = len(compressed)
|
clen = len(compressed)
|
||||||
compressed = ", ".join([hex(x) for x in compressed])
|
compressed = ", ".join([hex(x) for x in compressed])
|
||||||
|
|
Loading…
Reference in New Issue