<?php

	$com = false;
	$com = false;
	$distinct = false;

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

	
	$css = file("style.css");


	foreach ($css as $key => $val) {
		$val = trim($val);

		if ($val && stristr($val , "@import")) {
			$val = str_replace('@import url("' , "" , $val);
			$val = str_replace('");' , "" , $val);

			$files[] = $val;
		}
		
	}
		

	foreach ($files as $key => $val) {

		if ($com) {
			$content .=  "\n" . Compress(file_get_contents( $val));
		} else {

			if ($distinct) {
				$content .= "@import url('{$val}'); \n";
			} else {
				$content .=  "\n" . (file_get_contents( $val));	
			}
			


		}
		

		
	}

	header("Content-type: text/css");
	header("Cache-Control: max-age=2692000, public");

    header("Content-Length: ".strlen($content)); 
	echo $content;
	die();
	

?>