Seeking a solution for using specific functions from a Javascript file (lib.js) in a webpage without loading the entire file.
I am looking to achieve this through command line scripting, but have not yet found a method that works as desired.
The content of lib.js:
function dog() {
return 'Fido';
}
function famous_human() {
return 'Winston';
}
function human() {
return famous_human();
}
Code snippet calling functions from lib.js:
alert(human());
Desired output in lib-compiled.js:
function a() {return 'Winston';}
function human() {return a();}
- Function dog has been omitted due to non-usage.
- Function famous_human has been optimized.
- Function human retains its original name for external calling purposes.
- No code included from the snippet code-calling-functions-in-lib.js
Seeking help on how to achieve this result with a simple approach. Is there an easy solution?