[wp-hackers] Adding A CSS Loader

Timo Kissing timo.kissing+wordpress at gmail.com
Mon Apr 23 22:56:23 GMT 2007

Computer Guru wrote:
> Timo Kissing wrote:
>> Computer Guru schrieb:
>>> Chris wrote:
>>>> Another point..
>>>> Because CSS files are a cascade, would the order that plugins insert
>>>> their CSS files potentially change the final CSS result?
>>>> Chris
>>> Technically, yes.
>>> In reality, no.
>>> The reason is that if you had
>>> <link rel="stylesheet" href="mycss1.css" />
>>> <link rel="stylesheet" href="mycss2_from_plugin.css" />
>>> it's the same as
>>> $css_text = get_file_contents("mycss1.css");
>>> $css_text .= get_file_contents("mycss2_from_plugin.css");
>>> <link rel="stylesheet" href="dynamicstylesheet.php" />
>>> Order is still there and hasn't changed. Plus, the WP_Filter priority
>>> thing would work great here too...
>> Except that the latter means 2 file IO operations for every request (1
>> if you cache the result, but then you have overhead to find out if the
>> cache is still up2date). And you will have to check for file dates too
>> and set appropriate headers (mainly last modified) so the clients
>> caching works.
> How so?
> The first is also two.

Yes, but the second needs the 2 IO operations everytime any of the files
changes (with proper caching, otherwise it will need 2 for every
request), while in the first scenario with usual settings for client and
server only the changed file *should* be read from disk completly while
etag and last-modified of the other file should make the client use a
cached version.


More information about the wp-hackers mailing list