Allow to minify cacheable HTML and XML responses using htmlcompressor.
Add this line in your composer.json require section:
"matthecat/htmlcompressor-bundle": "dev-master"
and run this command in your project directory:
$ php composer.phar update matthecat/htmlcompressor-bundle
Edit your application's kernel:
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new MatTheCat\HtmlCompressorBundle\MatTheCatHtmlCompressorBundle(),
);
}
Now, it's time to configure it!
# app/config/config.yml
html_compressor:
enabled: true
java: /usr/bin/java
jar: ~
options: {}
Description | Default value | Exemple | |
---|---|---|---|
enabled | determine if responses must be minified if they can | true | - |
java | path to Java executable | /usr/bin/java | - |
jar | path to htmlcompressor executable | - | %kernel.root_dir%/Resources/java/htmlcompressor-1.5.3.jar |
options | any option described in the htmlcompressor documentation | - | { '--compress-js': ~, '--js-compressor': closure } |