Well, it was not exactly what I wanted, but it does work.

For some reason, putting the header info , text/css, in the php file   
does not work.
Instead, I had to put the below php code directly into my css file.

<?php
header('content-type:text/css');
header("Expires: ".gmdate("D, d M Y H:i:s", (time()+900)) . " GMT");
?>
....css stuff goes here.....


.htaccess file:
AddHandler application/x-httpd-php .css
php_value auto_prepend_file /path/to/compress-css.php


compress-css.php:
<?php

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;
   }
?>




On Nov 14, 2006, at 1:46 PM, Ingo Chao wrote:

> Graham Anderson 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/
>
>> .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
> ...
>
> Don't know much about php and server stuff, but your CSS file has  
> the wrong mime type ("text/html", instead of "text/css").
>
> Ingo
>
> -- 
> http://www.satzansatz.de/css.html

______________________________________________________________________
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