forked from x-tag/core
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·26 lines (23 loc) · 768 Bytes
/
build.sh
File metadata and controls
executable file
·26 lines (23 loc) · 768 Bytes
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
function compile () {
# Give names to arguments
input=$1
output=$2
# Read the js file
js=$(<$input)
# Google Closure Compiler API
url="http://closure-compiler.appspot.com/compile"
# WHITESPACE_ONLY, SIMPLE_OPTIMIZATIONS, ADVANCED_OPTIMIZATIONS
level="SIMPLE_OPTIMIZATIONS"
# text, json, xml
format="text"
# compiled_code, warnings, errors, statistics
info="compiled_code"
# compile using remote API
code=$(curl --data-urlencode "js_code=$js" --data "compilation_level=$level&output_format=$format&output_info=$info" $url)
# Write out
echo "$code" > $output
}
rm -rf ./dist/*
echo "Optomising using Google Closure"
compile "./src/CustomElements.js" "./dist/CustomElements.min.js"
compile "./src/MutationObserver.js" "./dist/MutationObserver.min.js"