minify phonegap javascript in xcode
How can I run a minification script on the javascript used in a phonegap project after it has been copied into the build by the "copy bundle resources" build phase?
I'm sure it should be a case of adding a script like:
for i in $DSTROOT/www/*.js
do
uglifyjs --overwrite $开发者_StackOverflowi
done
But $DSTROOT/www doesn't seem to be the folder it copies things too. What is the correct environment variable to use?
$PROJECT_DIR will get your output project directory. I combine all my js files in my www output directory first:
perl -pe 1 `find "$PROJECT_DIR/www" -name '*.js'` > "$PROJECT_DIR/www/all.js"
You can then minify your combined js in a single command with your chosen minifier.
精彩评论