public static function rewrite($css, $currentDir, $docRoot = null, $symlinks = array())
	{
		self::$_docRoot = self::_realpath(
			$docRoot ? $docRoot : $_SERVER['DOCUMENT_ROOT']
		);
		self::$_currentDir = self::_realpath($currentDir);
		self::$_symlinks = array();

		// normalize symlinks
		foreach ($symlinks as $link => $target) {
			$link = ($link === '//')
				? self::$_docRoot
				: str_replace('//', self::$_docRoot . '/', $link);
			$link = strtr($link, '/', DIRECTORY_SEPARATOR);
			self::$_symlinks[$link] = self::_realpath($target);
		}

		self::$debugText .= "docRoot    : " . self::$_docRoot . "\n"
						  . "currentDir : " . self::$_currentDir . "\n";
		if (self::$_symlinks) {
			self::$debugText .= "symlinks : " . var_export(self::$_symlinks, 1) . "\n";
		}
		self::$debugText .= "\n";

		$css = self::_trimUrls($css);

		// rewrite
		$css = preg_replace_callback('/@import\\s+([\'"])(.*?)[\'"]/'
			,array(self::$className, '_processUriCB'), $css);
		$css = preg_replace_callback('/url\\(\\s*([^\\)\\s]+)\\s*\\)/'
			,array(self::$className, '_processUriCB'), $css);

		return $css;
	}