Skip to content

Commit c168dda

Browse files
minify js
1 parent d3fbc13 commit c168dda

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
FROM debian:stable-slim
22

33
RUN DEBIAN_FRONTEND=noninteractive apt-get update &&\
4-
apt-get install -y wget minify &&\
4+
apt-get install -y wget &&\
55
wget https://github.com/mikefarah/yq/releases/download/v4.30.8/yq_linux_amd64 &&\
66
chmod a+x yq_linux_amd64 &&\
77
mv yq_linux_amd64 /usr/bin/yq &&\
8+
wget https://github.com/tdewolff/minify/releases/download/v2.12.4/minify_linux_amd64.tar.gz &&\
9+
tar -xzf minify_linux_amd64.tar.gz &&\
10+
chmod a+x minify &&\
11+
mv minify /usr/bin/ &&\
812
apt-get autoremove -y && apt-get clean -y
913

1014
COPY main.sh /main.sh

gen.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ for C in $COLORS; do
1111
CSS+=$(echo -e "\n[data-type*=$CT] {\nborder-color: $CC;\n}")
1212
fi
1313
done
14-
export CSS=$(echo "$CSS" | minify --type css)
14+
export CSS
1515

16-
export JS=$(perl -0pe 's/\/\*DATA\*\//\`$ENV{JSON}\`,/;' -pe 's/\/\/\/COLS\/\/\//$ENV{COLS}/;' -pe 's/\/\/\/PRINT_COLS\/\/\//$ENV{PRINT_COLS}/;' $DIR/script.js | minify --type js | perl -0pe 's/}`,];/}`,\/\*DATA\*\/];/;')
16+
export JS=$(perl -0pe 's/\/\*DATA\*\//\`$ENV{JSON}\`,/;' -pe 's/\/\/\/COLS\/\/\//$ENV{COLS}/;' -pe 's/\/\/\/PRINT_COLS\/\/\//$ENV{PRINT_COLS}/;' $DIR/script.js)
1717

18-
TEXT=$(minify $DIR/pinout.html | perl -0pe 's/###JS###/$ENV{JS}/;' -pe 's/###CSS###/$ENV{CSS}/;')
18+
TEXT=$(perl -0pe 's/###JS###/$ENV{JS}/;' -pe 's/###CSS###/$ENV{CSS}/;' $DIR/pinout.html | minify --type html | perl -0pe 's/}`]/}`,\/\*DATA\*\/]/;')
1919
if [ $? -ne 0 ]; then
2020
echo "Error in gen.sh"
2121
exit 1;

script.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
;(function() {
12
// gen.sh and append.sh replace DATA with the JSON of a connector
23
var connectorData = [
34
/*DATA*/
@@ -326,3 +327,4 @@ window.addEventListener('load', function() {
326327
}
327328
}
328329
});
330+
})()

0 commit comments

Comments
 (0)