Skip to content

Commit 15fe386

Browse files
committed
Fix build and minify html and js
1 parent 425a0ef commit 15fe386

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

docs/library/hashlib.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
.. module:: hashlib
77
:synopsis: hashing algorithms
8+
:noindex:
89

910
|see_cpython_module| :mod:`cpython:hashlib`.
1011

requirements-dev.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ pyelftools
2626

2727
# for stubs and annotations
2828
adafruit-circuitpython-typing
29+
30+
# for web workflow minify
31+
minify_html
32+
jsmin

supervisor/shared/web_workflow/websocket.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626

2727
#include "supervisor/shared/web_workflow/websocket.h"
2828

29+
// TODO: Remove ESP specific stuff. For now, it is useful as we refine the server.
30+
#include "esp_log.h"
31+
2932
typedef struct {
3033
socketpool_socket_obj_t socket;
3134
uint8_t opcode;

tools/gen_web_workflow_static.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
import argparse
66
import gzip
7+
import minify_html
8+
import jsmin
79
import mimetypes
810
import pathlib
911

@@ -24,6 +26,10 @@
2426
variable = path.name.replace(".", "_")
2527
uncompressed = f.read()
2628
ulen = len(uncompressed)
29+
if f.name.endswith(".html"):
30+
uncompressed = minify_html.minify(uncompressed.decode("utf-8")).encode("utf-8")
31+
elif f.name.endswith(".js"):
32+
uncompressed = jsmin.jsmin(uncompressed.decode("utf-8")).encode("utf-8")
2733
compressed = gzip.compress(uncompressed)
2834
clen = len(compressed)
2935
compressed = ", ".join([hex(x) for x in compressed])

0 commit comments

Comments
 (0)