Use Closure Compiler Command Line Minify and Replace Original File

时光毁灭记忆、已成空白 提交于 2019-11-28 09:45:07

问题


I tried

java -jar compiler.jar --js jj.js --js_output_file jj.js

The output file size is 0.

If I do not want to do a renaming from .min.js to .js, what should I do?


回答1:


The compiler doesn't not support this. I believe the next release will actually fail before overwriting the file.




回答2:


It isn't possible - for safety's sake although the following bash script achieves what you want to:

#!/bin/sh
for js in $(find ./public_html -name *.js)
do
        java -jar compiler.jar --js $js --js_output_file $js.min
        mv $js.min $js
done


来源:https://stackoverflow.com/questions/14621504/use-closure-compiler-command-line-minify-and-replace-original-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!