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

Andrew Ozz admin at laptoptips.ca
Tue Dec 1 21:52:50 UTC 2009

Otto wrote:
> Actually, upon a further reading through the code, I see that it does
> a check such that only scripts in the default directories get handled
> in this manner. These would be the scripts in /wp-admin/js/ and
> /wp-includes/js/ dirs. I didn't know it did that, though I can see
> why...

Both load-styles.php and load-scripts.php can only process default 
scripts and stylesheets as they don't load the rest of WordPress. The 
URLs are taken from script-loader.php where they are hard-coded.

Otherwise we would need to load WordPress at least three times for every 
page: once for the html, once for js and once for css...

There are other ways to do concatenating of all scripts and styles 
including the queue from plugins but it involves saving the ready files 
to the server similar to how WP Super Cache works, so not a good idea 
for core as it needs proper server config, etc.

I actually have some code to do this that's been sitting around for a 
while due to lack of time, if somebody wants to team up we could make it 
into a plugin :)

More information about the wp-hackers mailing list