Search code examples
javascriptjqueryconcept

Remove unwanted jQuery functions


Helo,

A library like jQuery is fully loaded and comes with many functions that we may not use in our scripts. Am wondering if there is a way to say read my script find out all the jQuery functions that I am using and its dependencies and then remove the remaining functions from the jQuery library. This could be applied to virtually any library and is not really a jQuery specific question.

Do let me know your thoughts on how this is achievable. I know it may be a headache later if say I add a new function to my code and the function does not exist in jQuery. But am willing to take that risk.


Solution

  • You could use closure compiler:

    It seems to do what you want.