Is there a way to remove unused lines of a JS Library?
<p>I currently coded something awesome based on a JS Library, and I want to remove every useless line that is doing nothing but take more time to download from the server.</p>

<p><strong>What is the best way to keep track of what piece of code was used/unused when my code executed?</strong> (So I can remove the unused code)</p>

<p>My first thoughts are to put <code>"var log += "&lt;br /&gt;Function name was used."</code> on every function and remove every function that wasn't called. But I am curious about if there is another way</p>

<p><em>I want to point out that modifying certain JS Libraries might violate their Licences and possibly cause strong legal issues. So if anyone is reading this and is planning to do the same thing as me, please read carefully the Licence(s) before you even attempt to do this!</em></p>
