I have a javascript-file (lib.js) and I want to use some of the functions in an web page but I don't want to load the full lib.js.
However, I have not figured out how to do what I want. I want to use command line.
lib.js
function dog() {
return 'Fido';
}
function famous_human() {
return 'Winston';
}
function human() {
return famous_human();
}
code-calling-functions-in-lib.js
alert(human());
Desired result, lib-compiled.js
function a() {return 'Winston';}function human() {return a();}
- Function dog is removed since I don't use it.
- Function famous_human is is optimized.
- Function human has its original name since I want to call it from other code.
- No code from 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
Is there a simple answer to my question?