protected function pipeline(array $assets, $extension, $subdirectory, Closure $minifier)
	{
		// Create destination dir if it doesn't exist.
		$pipeline_dir = $this->public_dir . DIRECTORY_SEPARATOR . $subdirectory . DIRECTORY_SEPARATOR . $this->pipeline_dir;
		if( ! is_dir($pipeline_dir))
			mkdir($pipeline_dir, 0777, true);

		// Generate paths
		$filename = $this->calculatePipelineHash($assets) . $extension;
		$relative_path = "$subdirectory/{$this->pipeline_dir}/$filename";
		$absolute_path = realpath($pipeline_dir) . DIRECTORY_SEPARATOR . $filename;

		// If pipeline already exists return it
		if(file_exists($absolute_path))
			return $relative_path;

		// Download, concatenate and minifiy files
		$buffer = $this->packLinks($assets, $minifier);

		// Write minified file
		file_put_contents($absolute_path, $buffer);

		// Write gziped file
		if($gzipAvailable = (function_exists('gzencode') and $this->pipeline_gzip !== false))
		{
			$level = ($this->pipeline_gzip === true) ? -1 : intval($this->pipeline_gzip);
			file_put_contents("$absolute_path.gz", gzencode($buffer, $level));
		}

		// Hook for pipeline event
		if($this->notify_command instanceof Closure)
			$this->notify_command->__invoke($filename, $relative_path, $absolute_path, $assets, $gzipAvailable);

		return $relative_path;
	}