[wp-hackers] Adding A CSS Loader

Burobjorn burobjorn at gmail.com
Mon Apr 23 13:56:47 GMT 2007


This seems like a good proposal.

I would like to add the same idea for the addition of javascript. 
Although I wonder about the order which might cause issues with 
javascript files (such as with prototype and jquery). I'm not sure if 
the same would apply to css.

grtz
BjornW



> I just spent the weekend on a couple of sites I manage going through plugins
> and stripping out all the CSS so it can all be contained within 1 file.
> Considering the number of plugins using their own style rules, I was
> thinking that perhaps we could take another lesson from something Drupal has
> done recently and works great - A CSS loader. 
> 
>  
> 
> Basically we would create a function, add_css('stylesheet_location'), or
> something similar. This would store all the css files in an array which
> would be dumped out with the proper format during the head call. What this
> would also allow is for us to create a caching mechanism for all the CSS
> files. Basically we could have Wordpress combine all the CSS files into a
> master CSS file and then save that file in the cache directory. This would
> reduce the number of calls to the server to load X number of style sheets
> from each plugin that requires them.
> 
>  
> 
> We shouldn't have any legacy issues with this really, as those could still
> require upon the head hook to inject their CSS (same applies to dynamic CSS
> files). It would also require themes remove the CSS from their header.php
> file for this to work, but if they don't then there is no problem, it will
> just fallback to the current method. Since the theme's CSS file will also
> remain stored with the theme, we can also continue to utilize the head
> section of the CSS file for theme information.
> 
>  
> 
> Thoughts?
> 
>  
> 
> Jamie Holly
> 
> http://www.intoxination.net
> 
> _______________________________________________
> 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