September 12, 201114 yr I'm using jQuery UI to make forms more intuitive. jQuery UI allows you to pick and choose the individual features you want. The downside to this is rather than one file, you end up with lots.... I currently have the following: <script src="<?php bloginfo('template_directory'); ?>/js/jquery.ui.core.js"></script> <script src="<?php bloginfo('template_directory'); ?>/js/jquery.ui.widget.js"></script> <script src="<?php bloginfo('template_directory'); ?>/js/jquery.ui.position.js"></script> <script src="<?php bloginfo('template_directory'); ?>/js/jquery.ui.autocomplete.js"></script> <script src="<?php bloginfo('template_directory'); ?>/js/jquery.ui.datepicker.js"></script> Would it be a good idea to chuck them all in to one file? I'm using other jQuery too, obviously, so right now I have another 4/5 files on top of that. I don't really want the page loading lots of Javascript files. I'm used to using W3 Total cache on Wordpress...but I've had mixed results, quite often it breaks the files and you have to un-minify them, which kind of defeats the point.
September 12, 201114 yr You can download a custom minified package with only the components you want here. To be honest, it's probably quicker to link to the whole jQuery UI package on Google's CDN instead - there's a good chance the user will already have cached it, and if they haven't it's on a separate domain so it won't count against your concurrent HTTP request limit. Edited September 12, 201114 yr by Renaissance-Design
September 12, 201114 yr Author I swear that's what I got and the minified files were still separate. I'll try again. Can you link to a single minified file for what I need on the CDN?
September 12, 201114 yr Can you link to a single minified file for what I need on the CDN? Nope. That would defeat part of the object anyway, as there'd be a far smaller chance of the user already having it cached.
September 12, 201114 yr Would it be a good idea to chuck them all in to one file? I'm using other jQuery too, obviously, so right now I have another 4/5 files on top of that. I don't really want the page loading lots of Javascript files. An alternative, which I use, is HeadJS, which allows you to load multiple .js files in parallel. There is a version which includes the HTML5 Shiv and mini-Modernizr, and a version without. Edited September 12, 201114 yr by Joe J
September 12, 201114 yr Author Ah ok. I'll use the Google one then. At least it's reducing 6 files down to one! Just implemented it and everything seems fine. I've got a lot of inline JS I need to sort out too.
Create an account or sign in to comment