So far, we've seen how we can easily minify code without any effort – but what if minifying isn't enough, and we need to remove redundant code?
Well, we can manually eyeball the code – nothing wrong with that. It's a perfectly acceptable way of working out what we can remove. The key thing though is that it is a manual process, which requires a lot of time and effort – not to mention the frequent attempts to find code that we can remove without breaking something else!
A smarter move is to set Node to work out for us what is being used, and what could be safely dropped. The web performance expert Gaël Métais has created unused JS to help with this. It works with Node, and is available at https://www.npmjs.com/package/unusedjs. It's a work in progress, but as long as it is used as a guideline, it can produce a useful basis for us to work out where we can make changes.
Let's take a moment to dig in and see how it works. For this demo, we'll use the Tooltip plugin...