Jason Crosse wrote: > On 18/02/2008 16:09, Rick Faircloth wrote: > >> I've realized at the start of a pretty large site, including >> Internet and Intranet sections, that my stylesheet could grow >> very large and even finding sections of styles for particular >> pages could be a cumbersome task. >> >> What I'm considering is having one main stylesheet, then >> having supplemental stylesheet for the various pages I will create. >> E.g., for a particular page, I would have main.css, plus index.css. >> For announcements, I would have main.css, plus announcements.css. >> >> I would be avoiding loading a lot of irrelevant styles for a particular >> page and make finding style references much easier, too. >> > > You could take the modular approach. Instead of creating stylesheets > for individual pages, you could, for example have > > * common.css > * web.css > * intranet.css > > Having individual style files for individual pages seems worse than > embedding styles in the head of a document. It seems to me you've > got all the disadvantages plus extra calls to the server. > This may be a slightly off-topic thread, but in the meanwhile... If you are concerned about performance you should combine everything, even more if you have a server-side language at your disposition. So what I mean is a little bit more of a complex solution...
Having separate style sheets usually helps to keep everything organized (depending on how you build them), but it also gives you more connections to the server. So what you can do is to make use of that server-side language you have, just make sure to send the appropriate HTTP headers. I.e: In the (x)HTML page: <link rel="stylesheet" type="text/css" href="css.dynamic.xxx/common/web" /> In css.dynamic.xxx, something like - split path-info by '/' - check by matching against the available files - send headers and embed all the files into one <off-topic> I haven't used Cold Fusion, but in PHP (css.dynamic.php) it would be something like this... [[ /illustrative code only/ ]] ob_start('ob_gzhandler'); ob_implicit_flush(FALSE); header('Content-Type: text/css'); $available_css = array( 'common', 'web', 'intranet' ); $css_files = explode('/', @$_SERVER['ORIG_PATH_INFO']); $css_files = array_intersect($css_files, $available_css); $num_css_files = count($css_files); $last = time(); for ( $i = 0; $i < $num_css_files; $i ++ ) { $file = "some/path/{$css_files[$i]}.css"; $stamp = filemtime($file); if ( 0 == $i || $stamp > $last ) { $last = $stamp; } echo "\n\n/***** ", ucfirst($css_files[$i]), " *****/\n\n"; readfile($file); } header('Last-Modified: '. gmdate('D, d M Y H:i:s \G\M\T', $last)); ob_end_flush(); </off-topic> Rafael. ______________________________________________________________________ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/