如何JavaScript文件COM pression与YUI的COM pressor自动化? [英] How to automate JavaScript files compression with YUI Compressor?
本文介绍了如何JavaScript文件COM pression与YUI的COM pressor自动化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
YUI的COM pressor 不接受通配符的参数,所以我不能像运行这样的:
YUI Compressor does not accept wildcard parameters, so I cannot run it like this:
C:>java -jar yuicompressor.jar *.js
但我有超过500个文件,宁可不必须创建这样一个批处理文件:
But I have over 500 files and would rather not have to create a batch file like this:
C:>java -jar yuicompressor.jar file1.js -o deploy\file1.js
C:>java -jar yuicompressor.jar file2.js -o deploy\file2.js
...
C:>java -jar yuicompressor.jar file500.js -o deploy\file500.js
当然我的文件名的没有这样统一的方式的
有没有办法无需编写任何code自动化这个? :)
Is there way to automate this without writing any code? :)
推荐答案
我可能会去一个makefile(我认为这很可能是更容易维护长期的),但是如果你想快速正肮脏的Windows批处理命令的东西像下面应该工作:
I might go for a makefile (I think it would probably be more maintainable long term), but if you want a quick-n-dirty Windows batch command something like the following should work:
for %%a in (*.js) do @java -jar yuicompressor.jar "%%a" -o "deploy\%%a"
这篇关于如何JavaScript文件COM pression与YUI的COM pressor自动化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文