1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 13:00:08 +00:00
pdf2htmlEX/share/build_js.sh

28 lines
942 B
Bash
Raw Normal View History

2014-07-13 23:59:30 +00:00
#!/bin/sh -ex
2013-10-19 07:06:32 +00:00
# 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)
2013-10-30 07:50:07 +00:00
CLOSURE_COMPILER_DIR="$BASEDIR/../3rdparty/closure-compiler"
2013-10-22 07:03:07 +00:00
CLOSURE_COMPILER_JAR="$CLOSURE_COMPILER_DIR/compiler.jar"
INPUT="$BASEDIR/pdf2htmlEX.js"
2013-10-23 17:54:40 +00:00
OUTPUT_FN="pdf2htmlEX.min.js"
2013-10-30 07:50:07 +00:00
OUTPUT="$BASEDIR/$OUTPUT_FN"
2013-10-19 07:06:32 +00:00
2013-10-23 17:54:40 +00:00
(echo "Building $OUTPUT_FN with closure-compiler..." && \
2013-10-22 07:03:07 +00:00
java -jar "$CLOSURE_COMPILER_JAR" \
2013-10-21 02:25:11 +00:00
--compilation_level ADVANCED_OPTIMIZATIONS \
2013-10-22 13:32:02 +00:00
--warning_level VERBOSE \
2013-11-08 08:45:32 +00:00
--output_wrapper "(function(){%output%})();" \
2013-10-22 07:03:07 +00:00
--js "$INPUT" \
--js_output_file "$OUTPUT" && \
2013-10-20 07:11:07 +00:00
echo 'Done.') || \
(echo 'Failed. Read `3rdparty/closure-compiler/README` for more detail.' && \
2013-10-22 07:03:07 +00:00
echo 'Using the uncompressed version.' && \
cat "$INPUT" > "$OUTPUT")
2013-10-21 01:33:38 +00:00