Fix build and minify html and js
This commit is contained in:
parent
425a0efeca
commit
15fe386457
|
@ -5,6 +5,7 @@
|
|||
|
||||
.. module:: hashlib
|
||||
:synopsis: hashing algorithms
|
||||
:noindex:
|
||||
|
||||
|see_cpython_module| :mod:`cpython:hashlib`.
|
||||
|
||||
|
|
|
@ -26,3 +26,7 @@ pyelftools
|
|||
|
||||
# for stubs and annotations
|
||||
adafruit-circuitpython-typing
|
||||
|
||||
# for web workflow minify
|
||||
minify_html
|
||||
jsmin
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
|
||||
#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 {
|
||||
socketpool_socket_obj_t socket;
|
||||
uint8_t opcode;
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
import argparse
|
||||
import gzip
|
||||
import minify_html
|
||||
import jsmin
|
||||
import mimetypes
|
||||
import pathlib
|
||||
|
||||
|
@ -24,6 +26,10 @@ for f in args.files:
|
|||
variable = path.name.replace(".", "_")
|
||||
uncompressed = f.read()
|
||||
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)
|
||||
clen = len(compressed)
|
||||
compressed = ", ".join([hex(x) for x in compressed])
|
||||
|
|
Loading…
Reference in New Issue