build_js.sh 940 B

123456789101112131415161718192021222324252627
  1. #!/bin/sh -ex
  2. # Compile and optimize JS code
  3. # Copyright 2013 Lu Wang <coolwanglu@gmail.com>
  4. # To enable closure-compiler, you need to install and configure JAVA environment
  5. # Read 3rdparty/closure-compiler/README for details
  6. BASEDIR=$(dirname $0)
  7. CLOSURE_COMPILER_DIR="$BASEDIR/../3rdparty/closure-compiler"
  8. CLOSURE_COMPILER_JAR="$CLOSURE_COMPILER_DIR/compiler.jar"
  9. INPUT="$BASEDIR/pdf2htmlEX.js"
  10. OUTPUT_FN="pdf2htmlEX.min.js"
  11. OUTPUT="$BASEDIR/$OUTPUT_FN"
  12. (echo "Building $OUTPUT_FN with closure-compiler..." && \
  13. java -jar "$CLOSURE_COMPILER_JAR" \
  14. --compilation_level SIMPLE_OPTIMIZATIONS \
  15. --warning_level VERBOSE \
  16. --output_wrapper "(function(){%output%})();" \
  17. --js "$INPUT" \
  18. --js_output_file "$OUTPUT" && \
  19. echo 'Done.') || \
  20. (echo 'Failed. Read `3rdparty/closure-compiler/README` for more detail.' && \
  21. echo 'Using the uncompressed version.' && \
  22. cat "$INPUT" > "$OUTPUT")