Too many jquery plugins?

后端 未结 9 1962
借酒劲吻你
借酒劲吻你 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:36

    If the plugins will be adding value to your site, I cannot see how that will be a problem. In general, plugins contain just enough code to do what they were meant to do. This makes their use quite a good practice when compared to using one monolithic library with plenty of unused functionality.

    As for concatenating the JavaScript files together, that can help in terms of front-end loading performance, so I would recommend that.

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

    No Mate it is not good practice to bring plugin before you fully confirm to yourself the job can not be done easily you writing the code.

    And even then always check the maintenance, reputation of the plugin writer and it's testability.

    Plugins are code written by third party. No matter how good they are they are never customized to your needs (even with all the options parameters).

    There are just way to many plugins out there that do so many simple things with 4 pages of JS. While spending 15min you can achieve exactly what you want in 10lines

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

    Bad practice or not, if you consider yourself as developer you should think about whether to grab a plugin or do-it-yourself.

    Of course one could state, why should I invent the wheel if somebody already did that in the past, but I'd always prefer to do things on my own if it's not a massive overkill.

    I guess there are lots of advantages doing it yourself, like maintenance (knowing what's going on at all times), you increase your programming knowledge etc.

    On the other hand, time is money so people could bring that into play. That of course is a good point nowadays. So maybe this whole topic comes down to a individual decision.

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

    I use $.getScript() to load plugins on $(document).ready(). Don't know if its a good practice or not but it seems to slightly decrease the document load time and allows me to load plugins as deemed necessary.

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

    Many sites require the use of large and often many JavaScript files. Whether this is in the way of plug-ins or custom scripts.

    In this case I would suggest you look at performance of your application. For example minifying your JavaScript files and where possible send them to the client gzipped with expire headers so they can be cached.

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

    Not sure what technologies you're using but I use http://github.com/jetheredge/bundler (ASP.Net/MVC) by Justin Etheredge.

    very simple framework that I could leverage to combine my css and javascript without a lot of fuss

    The JavaScript minifying and combining is handled by JSMin. Css compressing done with stock YUI compressor.

    If you're using php am sure there will be some alternative :) As mentioned above using a cdn and reducing http requests can benefit your website.

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