protected function combineCssFiles()
	{
		// Check the need for combination
		if (count($this->cssFiles) < 2)
			return;

		$cssFiles = array();
		$toBeCombined = array();
		foreach ($this->cssFiles as $url => $media)
		{
			$file = $this->getLocalPath($url);

			if ($file === false)
				$cssFiles[$url] = $media;
			else
			{
				$media = strtolower($media);
				if ($media === '')
					$media = 'all';
				if (!isset($toBeCombined[$media]))
					$toBeCombined[$media] = array();
				$toBeCombined[$media][$url] = $file;
			}
		}

		foreach ($toBeCombined as $media => $files)
		{
			if ($media === 'all')
				$media = '';

			if (count($files) === 1)
				$url = key($files);
			else
			{
				// get unique combined filename
				$fname = $this->getCombinedFileName($this->cssFileName, $files, $media);
				$fpath = Yii::app()->assetManager->getBasePath() . DIRECTORY_SEPARATOR . $fname;

				// check exists file
				if ($valid = file_exists($fpath))
				{
					$mtime = filemtime($fpath);
					foreach ($files as $file)
					{
						if ($mtime < filemtime($file))
						{
							$valid = false;
							break;
						}
					}
				}

				// re-generate the file
				if (!$valid)
				{
					$urlRegex = '#url\s*\(\s*([\'"])?(?!/|http://|data\:)([^\'"\s])#i';
					$fileBuffer = '';
					foreach ($files as $url => $file)
					{
						$contents = file_get_contents($file);
						if ($contents)
						{
							// Reset relative url() in css file
							if (preg_match($urlRegex, $contents))
							{
								$reurl = $this->getRelativeUrl(Yii::app()->assetManager->baseUrl, dirname($url));
								$contents = preg_replace($urlRegex, 'url(${1}' . $reurl . '/${2}', $contents);
							}
							
							if ($this->optimizeCssFiles && strpos($file, '.min.') === false && strpos($file, '.pack.') === false)
							{
								$contents = $this->optimizeCssCode($contents);
							}
							$fileBuffer .= (($this->optimizeCssFiles == true) ? preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $contents) : $contents);
						}
					}
					file_put_contents($fpath, $fileBuffer);
					//Yii::app()->cache->set('combineJs' . md5($fpath) . md5($fname), true);
				}
				// real url of combined file
				$url = Yii::app()->assetManager->getBaseRelUrl() . '/' . $fname;
			}
			$cssFiles[$url] = $media;
		}
		// use new cssFiles list replace old ones
		$this->cssFiles = $cssFiles;
	}