CSS Optimisations on WP_Styles (Was: [wp-hackers] WP Theme Directory Submission Restrictions)

DD32 wordpress at dd32.id.au
Tue Oct 7 05:41:26 GMT 2008


On Tue, 07 Oct 2008 16:03:49 +1100, Mike Schinkel <mikeschinkel at gmail.com>  
wrote:

>> http://trac.wordpress.org/ticket/3372 is related to
>> that idea.
>
> Thanks, I'll check it out.  (Sadly it seems the issue was first  
> presented 2
> years ago and still not addressed...)
>
>> The CSS implementation of that would probably work
>> pretty well if all the CSS rules were prefixed with
>> page ID's and the JS implementation probably needs
>> a bit more work on dependancy and loading orders/etc..
>
> Why would IDs need to be prefixed, assuming optimization is done on a
> per-page basis?

Ah yes, Well.. It could be done on a per-page basis, But that would remove  
nearly all gains that'd be achieved, The time it takes for WP to load  
server side, combine all the scripts together, etc, is about the same time  
that it'd take for any decent web server to serve up half a dozen static  
files, and the client should see no speed decrease thanks to HTTP  
Keepalives and Static compression at the server level.

My original idea when implementing that quick plugin was to find out if  
compressing ALL styles would overcome the PHP/WP loading times, as  
hopefully it'd only have to load once a session (You'd add in some extra  
E-tags and caching headers of course)

> That said, having two (2) CSS files or even three (3) can sometimes be
> better than having only one (1), i.e. if one is a large CSS file that's
> global for the site and the other is smaller and page specific. I'm  
> assuming
> that the first one would be cached so only loaded once.

Thats basically what happens at present, A master stylesheet, and many  
smaller ones for various sections and/or features that are enabled for  
that page.

> To really optimize you can use three (3); one (1) that contains  
> everything
> needed for the current page and two (2) others that are the global and  
> page
> specific ones where the global one is preloaded and then cached using the
> same technicals as image preloading as described here:
> http://articles.techrepublic.com.com/5100-10878_11-5214317.html  (And
> actually when I said three (3) I really meant one (1) global and then one
> (1) combined and one (1) page specific CSS where you'd end up with the
> latter two (2) for each page on a site.)

In the end, I feel it comes down to Server speed, Serving static files is  
FAST, loading PHP and WordPress in comparison, is SLOW, The ammount of ms.  
saved by bundling all the page requests into a single request tends to be  
lost when it comes ot loading everything..

> Of course the three CSS file optimization adds significant complexity and
> could only be viable if somehow built int WP core. FWIW.
>
> -Mike
>
>
> -----Original Message-----
> From: wp-hackers-bounces at lists.automattic.com
> [mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of DD32
> Sent: Tuesday, October 07, 2008 12:44 AM
> To: wp-hackers at lists.automattic.com
> Subject: Re: [wp-hackers] WP Theme Directory Submission Restrictions
>
> http://trac.wordpress.org/ticket/3372 is related to that idea.
> The CSS implementation of that would probably work pretty well if all the
> CSS rules were prefixed with page ID's and the JS implementation probably
> needs a bit more work on dependancy and loading orders/etc..
>
> On Tue, 07 Oct 2008 15:28:04 +1100, Mike Schinkel  
> <mikeschinkel at gmail.com>
> wrote:
>
>> I have a lot of experience with Drupal and one thing Drupal does when
>> the optimization switch is turned on is it aggregates CSS files into
>> one when that optimization is turned on.  I don't like how Drupal does
>> it exactly and I think it could be implemented in a manner that would
>> not require the admin to even be aware of it but I'd like to posit
>> that maybe WordPress could come up with a conceptually similar
>> solution albiet w/o the admin burden?
>>
>> Such a plan probably couldn't solve immediate needs but might be a
>> nice addition in a 3.x version of WordPress.  Thoughts?
> _______________________________________________
> 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