2

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 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

Community
  • 1
  • 1
Adam Ramadhan
  • 22,712
  • 28
  • 84
  • 124
  • 1
    Simple mode or advanced mode? For advanced mode, it always comes out into one single file, but you can turn on the file-boundary markers so that you can manually cut the output file back into pieces. – Stephen Chung Jul 30 '11 at 05:22

2 Answers2

3

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)

Matt Ball
  • 354,903
  • 100
  • 647
  • 710
1

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/*

fatlinesofcode
  • 1,647
  • 18
  • 22