Wouldn't it make sense to take this load of the server and
compress your css files as a matter of deployment?

I use a makefile and keep my (in this case) javascript files
in filenames such as name.js.raw

The makefile produces a file name.js from name.js.raw which has
comments stripped out and (lots of other optimizations)

If you can't work with the filename extension, you could use a rule
for going from
something like name_raw.js -> name.js

Also is your approach compatible with HTTP compression (mod_deflate,
etc) ? I am not sure.

Stephan


On 11/14/06, Graham Anderson <[EMAIL PROTECTED]> wrote:
> I am trying to compress my css files with .htaccess and php.
>
> For some bizarre reason, Firefox and IE6 refuse to recognize/display
> the css
> In Safari, everything works fine
> An example: http://bravosantamonica.com/dev/bravo/
>
> Has anyone ran into this problem? And, is there a workaround?
>
> many thanks
> g
>
> .htaccess
> AddHandler application/x-httpd-php .css
> php_value auto_prepend_file /www/dev/bravo/css/compress-css.php
> php_value auto_append_file /www/dev/bravo/css/close-css.php
>
>
> compress-css.php
> <?php
>    header('Content-type: text/css');
>    ob_start("compress");
>
>   function compress($buffer) {
>      // remove comments
>      $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '',
> $buffer);
>
>         // remove tabs, spaces, newlines, etc.
>      $buffer = str_replace(array("\r\n", "\r", "\n", "\t", '  ', '
> ', '    '), '', $buffer);
>      return $buffer;
>    }
> ?>
>
>
> close-css.php
> <?php ob_end_flush();?>
> ______________________________________________________________________
> css-discuss [EMAIL PROTECTED]
> http://www.css-discuss.org/mailman/listinfo/css-d
> IE7 information -- http://css-discuss.incutio.com/?page=IE7
> List wiki/FAQ -- http://css-discuss.incutio.com/
> Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
>


-- 
Stephan Wehner
> http://stephan.sugarmotor.org
> http://stephansmap.org
> http://www.trafficlife.com
> http://www.buckmaster.ca
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7 information -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to