[wp-hackers] Hook into load-styles.php / load-scripts.php "queue"?

Milan Dinić liste at srpski.biz
Tue Dec 1 21:51:21 UTC 2009


First of all, load-scripts.php is only concatenating already minified
javascript files (at least those included with WP) so that we have fewer
requests per page.

I never really tested this, but I'm not sure if this approach is always good
in WP. For example, some files are only loaded on some pages (see this tip
from Ozh
http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plugin/).
If all files were always concatenated on each page, we will have
different requests to load-scripts.php so we will again download scripts
that we already downloaded, meaning that concatenation made more damage then
benefit.

As I said, I am not sure how this part of concatenating scripts in admin
works, but it is possible that there are problems described above.

Same applies to frontend too since you can enqueue some scripts in some
cases only. In this case it would get even worse because many more users
will download those files. There are plugins that do minification and
concatenation on frontend, see list here:
http://wordpress.org/support/topic/280624#post-1199931 For them I'm too not
sure what they do in case I described.

Just to clarify that I'm not against concatenation, I actually always use
it, but in WordPress you should carefully use it because it can make more
harm then good.

2009/12/1 Nathan Rice <ncrice at gmail.com>

> Out of curiosity, why aren't scripts minified using load_scripts.php when
> using wp_enqueue_script in a theme?
>
> ------------------
> Nathan Rice
> WordPress and Web Development
> www.nathanrice.net | twitter.com/nathanrice
>
>
> On Tue, Dec 1, 2009 at 4:25 PM, Otto <otto at ottodestruct.com> wrote:
>
> > wp_enqueue_script is the correct way. The minify and compress stuff is
> > automatically handled, if it is enabled.
> >
> > Just enqueue as normal, let WordPress deal with the rest.
> >
> > -Otto
> > Sent from Memphis, TN, United States
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> 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