[wp-hackers] JavaScript,wp_enqueue_script and concatenation

Tynan Colin Beatty junsuijin at gmail.com
Mon Aug 3 15:14:58 UTC 2009


It does not happen on its own. I chose to include a modified
load-scripts.php from wp-admin into my theme's files (modified to allow
concatenation of scripts from my theme as well as those in wp-includes/js
scripts), but haven't had time to determine an optimal method of also
including plugin scripts (there are other variables to consider when trying
to include them as well, since some of them need to load in header, whereas
I choose to load my concatenated script into the footer). The solution
speeds things up a fair amount even without including plugins in the
concatenated script (and if your theme doesn't have any js, would be even
easier to implement). I'm thinking a nice approach might be to have 1 call
to the concated script in head to take care of whatever has to be loaded
there, and then a 2nd call to the same load-scripts.php, concatenating all
the files that can wait for the footer.

On Mon, Aug 3, 2009 at 10:00 AM, Simon Wheatley
<simon at sweetinteraction.com>wrote:

> On Mon, Aug 3, 2009 at 2:11 PM, Otto<otto at ottodestruct.com> wrote:
> > On Sat, Aug 1, 2009 at 10:46 AM, Eric Martin<eric at ericmmartin.com>
> wrote:
> >> I use jQuery on my site and a handful of jquery plugins. I've been
> >> doing quite a bit of thinking about ways to concatenate the scripts
> >> together in order to reduce the number of requests made, while
> >> maintaining the usefulness and features provided by wp_enqueue_script.
> >
> > I'm pretty sure that 2.8 already has this built in. All scripts get
> > concatenated into a single call to load-scripts.php, if everything
> > supports it properly.
> >
>
> Does this happen outside the admin area? I haven't noticed it myself,
> but maybe my scripts calls aren't configured correctly.
>
> S
>
>
> ---
> Sweet Interaction Ltd is Registered in England/Wales, no. 6610741
> Registered office: 7 Malton Av, Manchester, M21 8AT
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list