Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

How much jQuery is too much?

How many jQuery plugins can I add into my page? Is there a limit for too much? Will adding a lot of plugins slow down the site?

I have found a lot of really cool jQuery plugins that I want to develop and incorporate into my site to play around with.. but I am worried that it will affect the site integrity or slow down the site for the end user.

Is this something I should be worried about? Can I use the Google Closure Compiler to help with this?

I'm talking about plugins such as a jQuery adaptive background, scrolling progress bar, on scroll effect layout, and a sliders. Will these hinder the site performance?

Should I compile these? I'd like to know before I design a wireframe around incorporating these plugins.

Thanks ahead of time for any advice!

Cheers,

1 Answer

Nicholas Olsen
seal-mask
.a{fill-rule:evenodd;}techdegree
Nicholas Olsen
Front End Web Development Techdegree Student 19,342 Points

I don't think there really is a good, straight-forward answer to this.

To simplify—Yes, adding a lot of plugins will slow down the site. It is something you should be worried about.

I would start with considering your project's purpose and audience. Are the plugins absolutely necessary to accomplish your goal? Is your audience elite gamers with really fast internet connections or elderly people logging on to a questionable Windows XP computer at a retirement home?

There are a lot of ways to optimize your website like including all plugins in one file, minifying your code, using sprites, optimizing your images, etc. but you still have to be reasonable. I've always kind of felt that a really well designed website has really really good basics. Great typography, great layout, great user experience. There are a lot of nifty jQuery plugins that are fun to have, but are really just novelties. I'd prefer to use jQuery to enhance the user experience by helping my users fill out forms or find information more easily. Those things may be less noticeable to non-designers, but I think they're key in making a very well designed website.

Here is a good article I found on creating a "performance budget" hope it helps!

Thanks Nicholas, great answer.

What is your opinion on using a compiler such as google closure?

I always add my script tags at the bottom of the page, use css as much as possible opposed to adding images and make sure all images I do add are saved for web, compressed and 72dpi.. I'm just trying to make sure I am working with best practices. Not too sure if compiling will help a lot for load times.

Nicholas Olsen
seal-mask
.a{fill-rule:evenodd;}techdegree
Nicholas Olsen
Front End Web Development Techdegree Student 19,342 Points

I think google closure is great but it requires that your javascript be written in a particular way. I don't think jQuery is compatible with closure.

edit: I may be mistaken about this—but this was my impression. I found this stackoverflow post that seems to suggest otherwise.