1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-07-07 18:30:34 +00:00
pdf2htmlEX/share/js_src/compile.sh

27 lines
1022 B
Bash
Raw Normal View History

2013-10-19 07:06:32 +00:00
#!/bin/sh
# 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"
2013-10-19 07:06:32 +00:00
OUTPUT="$BASEDIR/../pdf2htmlEX.js"
2013-10-20 08:35:31 +00:00
(echo 'Building pdf2htmlEX.js with closure-compiler...' && \
java -jar "$CLOSURE_COMPILER_DIR/compiler.jar" \
2013-10-21 02:25:11 +00:00
--compilation_level ADVANCED_OPTIMIZATIONS \
--process_jquery_primitives \
--externs "$CLOSURE_COMPILER_DIR/jquery-1.9.js" \
2013-10-21 02:25:11 +00:00
--js "$BASEDIR/header.js" \
--js "$BASEDIR/css_class_names.js" \
--js "$BASEDIR/viewer.js" \
--js_output_file "$OUTPUT" 2>/dev/null && \
2013-10-20 07:11:07 +00:00
echo 'Done.') || \
(echo 'Failed. Read `3rdparty/closure-compiler/README` for more detail.' && \
echo 'Fall back to naive concatenation' && \
cat "$BASEDIR/header.js" "$BASEDIR/css_class_names.js" "$BASEDIR/viewer.js" > "$OUTPUT")
2013-10-21 01:33:38 +00:00