使用Google Closure编译器将文件夹中的所有js压缩到新文件夹中? [英] compress all js in a folder to new folder useing google closure compiler?

查看:106
本文介绍了使用Google Closure编译器将文件夹中的所有js压缩到新文件夹中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何将文件夹中的所有js压缩到新文件夹?

我在google和stackoverflow周围进行搜索,我发现的只是 使用Google Closure压缩所有文件.js编译器应用程序放在一个文件中 把所有东西都放在一起..+我们可以放一个通配符之类的东西吗?

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

感谢您的光临

亚当·拉马丹

推荐答案

Bash脚本可助您一臂之力.像

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

(未经测试)

这篇关于使用Google Closure编译器将文件夹中的所有js压缩到新文件夹中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆