开发者

compress all js in a folder to new folder useing google closure compiler?

开发者 https://www.devze.com 2023-03-23 15:17 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消