vihuvac/htmlcompressor-bundle

Symfony2 bundle which allow to minify cacheable HTML and XML responses using htmlcompressor

v1.0.0 2016-03-01 02:26 UTC

This package is not auto-updated.

Last update: 2024-04-13 16:24:02 UTC


README

⚠️ DEPRECATED:

Unfortunately I want to inform this bundle is getting deprecated. Sorry for the inconvenience. 😔

Allow to minify cacheable HTML and XML responses using htmlcompressor.

Installation

Get the bundle

Add this line in your composer.json require section:

"vihuvac/htmlcompressor-bundle": "dev-master"

and run this command in your project directory:

$ php composer.phar update vihuvac/htmlcompressor-bundle

Enable the bundle

Edit your application's kernel:

// app/AppKernel.php

<?php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Vihuvac\Bundle\HtmlCompressorBundle\VihuvacHtmlCompressorBundle(),
    );
}

Now, it's time to configure it!

Configuration

# 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" : ~, "--compress-css" : ~, "--js-compressor" : closure, "--closure-opt-level" : simple }