Question

When using a JQuery plugin, is it a good idea to cut it down in order to only leave the parts necessary for your application or is it better to leave it as it is?

In a related question, is there an impact in performance having to load the entire plugin instead of only the parts you need?

Was it helpful?

Solution

There is always an overhead in loading any code (whether you need it or not):

  • network overhead to download code
  • overhead to parse code
  • overhead to execute additional code paths

However, there is also overhead in stripping down a plugin in that you are basically taking on responsibility for ongoing maintenance and you may introduce bugs inadvertantly.

My advice would be to only use plugins you genuinely need, and to vet the plugins to ensure code quality and that the feature set matches your requirements.

OTHER TIPS

You could use Require.js (http://requirejs.org/) to manage what plugins need to be loaded on each page or event

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top