Location: PHPKode > scripts > XCS Parser > xcs-parser/examples/compression.php
<?php
/**
 * Compression test/demo file for XcsParser class.
 */

error_reporting(E_ALL | E_STRICT);
include '../lib/XcsParser_class.php';

$css = file_get_contents('../etc/style.css');
$sp = new XcsParser($css);

echo "<h1>Compression levels</h1>\n";

echo "<h2>No compression/prettyfying</h2>\n";
echo $sp->setCompressionLevel(XcsParser::COMPRESS_NONE)
		->parse()
		->compress()
		->getCss();

echo "<h2>Prettyprint level 1, with comments</h2>\n";
echo $sp->setCommentsAreImportant(true)
		->setCompressionLevel(XcsParser::COMPRESS_PRETTY_READABLE)
		->parse()
		->compress()
		->getCss();

echo "<h2>Prettyprint level 2, with comments</h2>\n";
echo $sp->setCommentsAreImportant(true)
		->setCompressionLevel(XcsParser::COMPRESS_HUMAN_READABLE)
		->parse()
		->compress()
		->getCss();

echo "<h2>Prettyprint level 1, no comments</h2>\n";
echo $sp->setCommentsAreImportant(false)
		->setCompressionLevel(XcsParser::COMPRESS_PRETTY_READABLE)
		->parse()
		->compress()
		->getCss();

echo "<h2>Prettyprint level 2, no comments</h2>\n";
echo $sp->setCommentsAreImportant(false)
		->setCompressionLevel(XcsParser::COMPRESS_HUMAN_READABLE)
		->parse()
		->compress()
		->getCss();

echo "<h2>Compression</h2>\n";
echo $sp->setCompressionLevel(XcsParser::COMPRESS_ALL)
		->parse()
		->compress()
		->getCss();
?>
Return current item: XCS Parser