[wp-hackers] Adding A CSS Loader

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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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.

IMO for static css files (meaning all css files that are not parsed by
PHP anyhow) it will be *very hard* to code something in PHP that
performs as good as just referencing the css files directly.

lino
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGLS8boLzpFOt4gucRAlIhAJwJEIuYG9RlDSxvZvFiJJgubMdL8ACeJ53H
VC72cYFj6U790CR0SV7uNuY=
=Y9bY
-----END PGP SIGNATURE-----


More information about the wp-hackers mailing list