Skip to content

Instantly share code, notes, and snippets.

@saralilyb
Created March 19, 2017 17:10
Show Gist options
  • Save saralilyb/41cafc82325d0ee9d02a7ecdecb96ef0 to your computer and use it in GitHub Desktop.
Save saralilyb/41cafc82325d0ee9d02a7ecdecb96ef0 to your computer and use it in GitHub Desktop.
Shell script to compile javascript through Google Closure
#!/bin/sh
usage(){
echo "Usage: $0 inputfile.js closurecompiledfile.js"
exit 1
}
is_file_exits(){
local f="$1"
[[ -f "$f" ]] && return 0 || return 1
}
[[ $# -eq 0 ]] && usage
if ( is_file_exits "$1" )
then
java -jar ~/src/javascript/closure-compiler-v20170218.jar --js $1 --js_output_file $2
else
echo "File not found"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment