我有一个 javascript 文件 (lib.js),我想使用网页中的一些功能,但我不想加载完整的 lib.js。
但是,我还没有弄清楚如何做我想做的事。我想使用命令行。
lib.js
function dog() {
return 'Fido';
}
function famous_human() {
return 'Winston';
}
function human() {
return famous_human();
}
代码调用函数在 lib.js
alert(human());
期望的结果,lib-compiled.js
function a() {return 'Winston';}function human() {return a();}
- 功能 dog 被删除,因为我不使用它。
- 函数 Famous_human 是优化的。
- 函数 human 有它的原始名称,因为我想从其他代码中调用它。
- code-calling-functions-in-lib.js 中没有代码
.
java -jar compiler.jar --compilation_level ADVANCED_OPTIMIZATIONS --js lib.js --XXXXXXXX code-calling-functions-in-lib.js --js_output_file lib-compiled.js
我的问题有一个简单的答案吗?