Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

icedream/JavaScriptPackerBundle

Repository files navigation

JavaScript Packer Bundle for Symfony2

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.

About

Bundle to use Dean Edward's Packer (PHP port) with Symfony2/Assetic.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages