icedream/javascriptpackerbundle

This package is abandoned and no longer maintained. No replacement package was suggested.

Dean Edwards Packer, usable from Symfony2

1.0.0 2014-06-15 15:34 UTC

This package is not auto-updated.

Last update: 2020-01-20 03:52:07 UTC


README

This bundle allows you to use the PHP port of Dean Edward's Packer to compress JavaScripts

Beta disclaimer

Feel free to use this bundle but keep in mind it is still in beta stage and needs a bit of testing. If you see any issues with this bundle, please give feedback using the GitHub issue tracker.

Installation/Usage

  1. Install via composer:

    composer require icedream/javascriptpackerbundle:~1.0@beta
  2. Download the PHP port of Dean Edward's packer. The recommended way is to use the suggestion of this package and install meenie/javascript-packer via composer.

    composer require meenie/javascript-packer:~1.1
  3. Add bundle to the application kernel (app/AppKernel.php):

    <?php
    use Symfony\Component\HttpKernel\Kernel;
    use Symfony\Component\Config\Loader\LoaderInterface;
    
    class AppKernel extends Kernel
    {
        public function registerBundles()
        {
        	$bundles = array(
        		// ...
        		new Icedream\JavaScriptPackerBundle\JavaScriptPackerBundle(),
        		);
        	// ...
        }
    }
  4. Configure the bundle in app/config/config.yml:

    # Assetic Configuration
    assetic:
        filters:
            jspacker:
                resource: %kernel.root_dir%/../vendor/icedream/javascriptpackerbundle/Icedream/JavaScriptPackerBundle/Resources/config/services.xml
                # If you did not use the composer method to download the Packer script, uncomment this and point the variable to the full path of class.JavaScriptPacker.php
                #packer: %kernel.root_dir%/../vendor/meenie/javascript-packer/class.JavaScriptPacker.php
  5. Now you can use the filter as needed.

    {% javascripts '@AcmeDemoBundle/Resources/public/js/somescript.js' filter='jspacker' %}
    <script type="text/javascript" src="{{ asset_url }}"></script>
    {% endjavascripts %}

License

This bundle is licensed under the MIT license. See LICENSE.txt for more information.