Skip to content

Commit c593ab0

Browse files
fix multiple connectors
1 parent 8f6dce5 commit c593ab0

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

append.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22

33
DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)"/"
4-
JSON="$(echo $1 | sed 's/\\/\\\\\\\\/g')"
5-
TEXT=$(sed -e "/\/\/\/DATA\/\/\//{a \ \`$(echo ${JSON//\//\\/} | tr -d '\n')\ \`,\n///DATA///" -e "d}" $2)
4+
export JSON="$(echo $1 | minify --type json)"
5+
TEXT=$(perl -0pe 's/\/\*DATA\*\//\`$ENV{JSON}\`,\/\*DATA\*\//;' $2)
66
if [ $? -ne 0 ]; then
77
echo "Error in append.sh"
88
exit 1;

gen.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)"/"
4-
JSON="$(echo $1 | sed 's/\\/\\\\\\\\/g')"
4+
export JSON="$(echo $1 | minify --type json)"
55

66
CSS=$(cat $DIR/style.css)
77
for C in $COLORS; do
@@ -13,9 +13,9 @@ for C in $COLORS; do
1313
done
1414
export CSS=$(echo "$CSS" | minify --type css)
1515

16-
export JS=$(sed -e "s/\/\/\/DATA\/\/\//\`$(echo ${JSON//\//\\/} | tr -d '\n')\`,\n\/\/\/DATA\/\/\//" $DIR/script.js | perl -0pe "s/\/\/\/COLS\/\/\//${COLS}/" | perl -0pe "s/\/\/\/PRINT_COLS\/\/\//${PRINT_COLS}/" | minify --type js)
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\*\/];/;')
1717

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

script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// gen.sh and append.sh replace DATA with the JSON of a connector
22
var connectorData = [
3-
///DATA///
3+
/*DATA*/
44
];
55

66
// gen.sh replaces COLS and PRINT_COLS with the apropriate JSON objects

0 commit comments

Comments
 (0)