[wp-hackers] JavaScript,wp_enqueue_script and concatenation

Eric Martin emartin24 at gmail.com
Tue Aug 11 20:31:46 UTC 2009


As far as I can tell, the script concatenation only works in the admin
section.

So, I'm just trying to figure out how to use wp_enqueue_script for
multiple scripts, but then force WP to print out one script tag for a
certain set of them. Any suggestions?

Thanks!

On Aug 3, 8:14 am, Tynan Colin Beatty <junsui... at gmail.com> wrote:
> 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
> <si... at sweetinteraction.com>wrote:
>
>
>
> > On Mon, Aug 3, 2009 at 2:11 PM, Otto<o... at ottodestruct.com> wrote:
> > > On Sat, Aug 1, 2009 at 10:46 AM, Eric Martin<e... 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-hack... at lists.automattic.com
> >http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> _______________________________________________
> wp-hackers mailing list
> wp-hack... at lists.automattic.comhttp://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list