HTML: <link rel="stylesheet" href="compress_css.php" type="text/css"> PHP: compress_css.php header('Content-type: text/css'); ob_start("compress"); function compress($buffer) { /* Удаляем комментарии */ $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer); /* Удаляем табуляции, пробелы, переводы строки и так далее */ $buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer); return $buffer; } /* Список CSS файлов */ include('master.css'); include('typography.css'); include('grid.css'); include('print.css'); include('handheld.css'); ob_end_flush();
What do you think about my idea? Will all browsers work? (I tested it on my slipper, through the Opera browser it works)