fabiang/assetic-google-closure-compiler

Google Closure Compiler for the PHP assetic library (Java/JAR version)

v1.3.0 2024-01-24 10:11 UTC

This package is auto-updated.

Last update: 2024-10-24 11:49:03 UTC


README

Installation

New to Composer? Read the introduction. Run the following Composer command:

composer require --dev fabiang/assetic-google-closure-compiler

Note: Remove --dev if you don't compile the assets while building your application before deploying it and you need the filter on production.

Usage in a Laminas application

Add this filter to you assetic configuration (e.g. assetic.global.php):

<?php

return [
    'assetic_configuration' => [
        // [...]
        'modules'        => [
            'MyModule' => [
                'collections' => [
                    'my_collection' => [
                        'filters' => [
                            '?JSMinFilter' => [
                                'name'   => Assetic\Filter\GoogleClosure\CompilerJarFilter::class,
                                'option' => [
                                    realpath('node_modules/google-closure-compiler/compiler.jar'),
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
];

The class CompilerJarFilter accepts two arguments:

  1. the path to the composer.jar
  2. the path to your Java binary (default is /usr/bin/java)

Licence

BSD-2-Clause. See the LICENSE.md.