1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 04:50:09 +00:00
pdf2htmlEX/share/build_js.sh
2014-07-13 16:59:30 -07:00

28 lines
942 B
Bash
Executable File

#!/bin/sh -ex
# Compile and optimize JS code
# Copyright 2013 Lu Wang <coolwanglu@gmail.com>
# To enable closure-compiler, you need to install and configure JAVA environment
# Read 3rdparty/closure-compiler/README for details
BASEDIR=$(dirname $0)
CLOSURE_COMPILER_DIR="$BASEDIR/../3rdparty/closure-compiler"
CLOSURE_COMPILER_JAR="$CLOSURE_COMPILER_DIR/compiler.jar"
INPUT="$BASEDIR/pdf2htmlEX.js"
OUTPUT_FN="pdf2htmlEX.min.js"
OUTPUT="$BASEDIR/$OUTPUT_FN"
(echo "Building $OUTPUT_FN with closure-compiler..." && \
java -jar "$CLOSURE_COMPILER_JAR" \
--compilation_level ADVANCED_OPTIMIZATIONS \
--warning_level VERBOSE \
--output_wrapper "(function(){%output%})();" \
--js "$INPUT" \
--js_output_file "$OUTPUT" && \
echo 'Done.') || \
(echo 'Failed. Read `3rdparty/closure-compiler/README` for more detail.' && \
echo 'Using the uncompressed version.' && \
cat "$INPUT" > "$OUTPUT")