<?php
ini_set( 'display_errors', 0 );
error_reporting( E_ALL & ~E_NOTICE & ~E_STRICT );
#ini_set( 'display_errors', 1 );
#error_reporting( E_ALL );

$file = $_GET['file'];
header( 'Content-type: text/css' );

if( file_exists( str_replace( '.css', '.less', $file ) ) ){
	require_once( 'libraries/lessc.inc.php' );
	class lessc_formatter_sellsmart extends lessc_formatter_classic {
		public $disableSingle = true;
		public $open = " {";
		public $selectorSeparator = ", ";
		public $assignSeparator = ": ";
		public $break = "\n";
		public $compressColors = true;
		public $indentChar = "\t";
	}

	$less = new lessc;
	$less->setFormatter("sellsmart");
#	$less->setFormatter("compressed");

#	Odkomentuj poniższą linię, by style kompilowały się przy każdym odświeżeniu strony
#	unlink( $file );
	$less->checkedCompile(str_replace( '.css', '.less', $file ), $file);
}
readfile( $file );
exit;