Too many jquery plugins?

后端 未结 9 1963
借酒劲吻你
借酒劲吻你 2020-12-31 11:59

I\'m developing a website, but I realized that, in addition to the link to my main javascript file, and the link to the jquery file, it\'s beginning to look like I\'m going

相关标签:
9条回答
  • 2020-12-31 12:49

    Im working on the performance of a large corporate website that uses jQuery. We have found that a high number of connections can really kill performance.

    There are three things you can do with your plugins

    1. Minify the javascript using Google Closure Compiler.
    2. Combine the minified js into one download called eg plugins.min.js
    3. Set up an alternate domain for serving js content eg http:/scripts.acme.com.

    The minified js means it will download and parse faster, combined into one file will save some connections, and using a cookieless domain will reduce the data that has to be sent up to the server.

    Using a CDN eg Google for the main jquery file is also a good idea.

    0 讨论(0)
  • 2020-12-31 12:57

    your only problem will be maintenance re: upgrading versions. its a good idea to combine all your js together to reduce request overhead. I do this at deploy time

    0 讨论(0)
  • 2020-12-31 12:57

    Having jquery plugins in multiple files will allow you to only load those specific files needed for a given page. If all plugins are required for every page then this would not help.

    Also, remember to use a jquery cdn so load times should be faster.

    http://softwareas.com/google-jquery-cdn

    0 讨论(0)
提交回复
热议问题