aboutsummaryrefslogtreecommitdiff
path: root/deploy/build_js.sh
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-07-11 02:59:35 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-07-11 02:59:40 +0300
commit864e73cdc75a2fb0e4fad500f649dae2343c10a8 (patch)
tree6ce6762c6be72c98592a32fe0bed4f2ce751d544 /deploy/build_js.sh
parentcb13ea239b9f1ca6aea43125d5694d5a55dcd287 (diff)
rewrite css and js assets building
Diffstat (limited to 'deploy/build_js.sh')
-rwxr-xr-xdeploy/build_js.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/deploy/build_js.sh b/deploy/build_js.sh
new file mode 100755
index 0000000..b1019f7
--- /dev/null
+++ b/deploy/build_js.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+PROGNAME="$0"
+DIR="$( cd "$( dirname "$(readlink -f "${BASH_SOURCE[0]}")" )" && pwd )"
+
+. $DIR/build_common.sh
+
+# suckless version of webpack
+# watch and learn, bitches!
+build_chunk() {
+ local name="$1"
+ local output="$OUTDIR/$name.js"
+ local not_first=0
+ for file in "$INDIR/$name"/*.js; do
+ # insert newline before out comment
+ [ "$not_first" = "1" ] && echo "" >> "$output"
+ echo "/* $(basename "$file") */" >> "$output"
+
+ cat "$file" >> "$output"
+ not_first=1
+ done
+}
+
+TARGETS="common admin"
+
+input_args "$@"
+check_args
+
+for f in $TARGETS; do
+ build_chunk "$f"
+done \ No newline at end of file