forked from jakiestfu/Medium.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build
51 lines (40 loc) · 866 Bytes
/
build
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# directories
JS_IN_DIR='./src/Medium/'
JS_OUT_DIR='.'
JS_TEMP=""
JS_WRAPPER=$(<"$JS_IN_DIR/wrapper.js")
JS_COMBINED_FILE="$JS_OUT_DIR/medium.js"
JS_COMBINED_FILE_MIN="$JS_OUT_DIR/medium.min.js"
# JS files you want to combine together
JS_FILES=(
#constructors first
base.js
Action.js
Cache.js
Cursor.js
Drag.js
Element.js
Html.js
Injector.js
Selection.js
Toolbar.js
Undoable.js
Utilities.js
#everything else next
environmentCorrection.js
)
#clear the files
> $JS_COMBINED_FILE
> $JS_COMBINED_FILE_MIN
#run thru the JS files
for F in ${JS_FILES[@]}; do
CONTENTS=$(<"$JS_IN_DIR/$F")
JS_TEMP+="$CONTENTS"
done
echo "${JS_WRAPPER//CODE_HERE/$JS_TEMP}" > $JS_COMBINED_FILE
#compress it
yui-compressor -o $JS_COMBINED_FILE_MIN $JS_COMBINED_FILE
#add the file to the git base
git add $JS_COMBINED_FILE
git add $JS_COMBINED_FILE_MIN