forked from ciembor/4bit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·61 lines (49 loc) · 2.24 KB
/
build.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
################################################################################
# #
# Usage: #
# #
# ./build.sh - building in development (simple merging) #
# ./build.sh production - building in production (with compressing) #
# #
################################################################################
################################################################################
### Paths
APP_PATH=`pwd`
CLOSURE_LIB="../closure/closure"
COMPILER="/usr/share/java/closure-compiler/closure-compiler.jar"
################################################################################
### Options
closure_options="-o script"
less_options=""
if [ $# -ne 2 ]
then
if [[ "$1" = "production" ]]
then
closure_options="-o compiled -c ${COMPILER}"
less_options="-yui-compress"
fi
fi
################################################################################
### Helpers
status () {
if [ $? -gt 0 ]; then
echo -ne "[\e[1;31mERROR\e[m]\n"
exit 1
else
echo -ne "[\e[1;32mOK\e[m]\n"
fi
}
################################################################################
### Building
echo "==== Compiling JavaScript ======================================================"
python2 ${CLOSURE_LIB}/bin/calcdeps.py -i ${APP_PATH}/lib/js/jquery-ui-1.8.23.custom.js -i ${APP_PATH}/lib/js/jquery.ui.colorPicker.js -i ${APP_PATH}/js/main.js -p ${CLOSURE_LIB} ${closure_options} > ${APP_PATH}/js/compiled.js
status
echo "==== Compiling LESS ============================================================"
/usr/bin/lessc ${APP_PATH}/less/main.less ${APP_PATH}/css/_compiled_main.css ${less_options}
status
echo "==== Merging CSS ==============================================================="
cat ${APP_PATH}/css/jquery-ui-1.8.23.custom.css > ${APP_PATH}/css/merged.css
cat ${APP_PATH}/css/jquery.ui.colorPicker.css >> ${APP_PATH}/css/merged.css
cat ${APP_PATH}/css/_compiled_main.css >> ${APP_PATH}/css/merged.css
status