compress with UglifyJS -- ~6k savings
[dygraphs.git] / compile-with-closure.sh
... / ...
CommitLineData
1#!/bin/bash
2
3# This script runs dygraphs through the Closure Compiler. This checks for
4# errors (both in the JS and in the jsdoc) and flags type errors as WARNINGS.
5
6# It outputs minified JS to a temp file. This should be ignored for now, until
7# it's fully functional.
8
9CLOSURE_COMPILER=node_modules/closure-compiler/lib/vendor/compiler.jar
10BASE_JS=node_modules/obvious-closure-library/closure/goog/base.js
11if [[ (! -f $CLOSURE_COMPILER) || (! -f $BASE_JS) ]]; then
12 echo "Missing compiler.jar or base.js. Try running 'npm install'." 1>&2
13 exit 1
14fi
15
16java -jar $CLOSURE_COMPILER \
17 --compilation_level ADVANCED_OPTIMIZATIONS \
18 --warning_level VERBOSE \
19 --output_wrapper='(function() {%output%})();' \
20 --js $BASE_JS \
21 --js=dashed-canvas.js \
22 --js=dygraph-options.js \
23 --js=dygraph-layout.js \
24 --js=dygraph-canvas.js \
25 --js=dygraph.js \
26 --js=dygraph-utils.js \
27 --js=dygraph-gviz.js \
28 --js=dygraph-interaction-model.js \
29 --js=dygraph-tickers.js \
30 --js=dygraph-plugin-base.js \
31 --js=plugins/annotations.js \
32 --js=plugins/axes.js \
33 --js=plugins/chart-labels.js \
34 --js=plugins/grid.js \
35 --js=plugins/legend.js \
36 --js=plugins/range-selector.js \
37 --js=dygraph-plugin-install.js \
38 --js=dygraph-options-reference.js \
39 --js=datahandler/datahandler.js \
40 --js=datahandler/default.js \
41 --js=datahandler/default-fractions.js \
42 --js=datahandler/bars.js \
43 --js=datahandler/bars-custom.js \
44 --js=datahandler/bars-error.js \
45 --js=datahandler/bars-fractions.js \
46 --js=dygraph-exports.js \
47 --externs dygraph-internal.externs.js \
48 --externs gviz-api.js \
49 --js_output_file=/tmp/out.js