forked from johnnesky/beepbox
-
Notifications
You must be signed in to change notification settings - Fork 37
/
compile_beepbox_editor.sh
33 lines (29 loc) · 1.17 KB
/
compile_beepbox_editor.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
set -e
# Compile editor/main.ts into build/editor/main.js and dependencies
npx tsc
# Combine build/editor/main.js and dependencies into website/beepbox_editor.js
npx rollup build/editor/main.js \
--file website/beepbox_editor.js \
--format iife \
--output.name beepbox \
--context exports \
--sourcemap \
--plugin rollup-plugin-sourcemaps \
--plugin @rollup/plugin-node-resolve
# Minify website/beepbox_editor.js into website/beepbox_editor.min.js
npx terser \
website/beepbox_editor.js \
--source-map "content='website/beepbox_editor.js.map',url=beepbox_editor.min.js.map" \
-o website/beepbox_editor.min.js \
--compress \
--mangle \
--mangle-props regex="/^_.+/;"
# Combine the html and js into a single file for the offline version
sed \
-e '/INSERT_BEEPBOX_SOURCE_HERE/{r website/beepbox_editor.min.js' -e 'd' -e '}' \
-e '/INSERT_JQUERY_MIN_JS_HERE/{r website/offline_deps/jquery-3.4.1.min.js' -e 'd' -e '}' \
-e '/INSERT_SELECT2_MIN_JS_HERE/{r website/offline_deps/select2.min.js' -e 'd' -e '}' \
-e '/INSERT_SELECT2_CSS_HERE/{r website/offline_deps/select2.min.css' -e 'd' -e '}' \
website/jummbox_offline_template.html \
> website/jummbox_offline.html