compress all js in a folder to new folder useing google closure compiler?
how can i compress all my js in a folder to a new folder ?
i have search around google and stackoverflow, what i found is 开发者_StackOverflow社区just Compress all file .js with Google Closure Compiler Application in one File that puting it all to one.. + can we put a wildcard or something?
so i can do something like
java -jar bin/compiler.jar ../../path/my/*.js --js_output_file ../../path/new/*.js
thanks for looking in
Adam Ramadhan
Bash scripting to the rescue. Something like
files=`find ../../path/my -name "*.js"`
for i in $files;
do
java -jar bin/compiler.jar $i --js_output_file `dirname $i`../new/$i.js
done
(not tested)
I've got a bash script on gitub for this, https://github.com/fatlinesofcode/compile-js
works like this
compile-js build ../../path/new/output.min.js ../../path/my/*
精彩评论