2017 © Pedro Peláez
 

symfony-bundle assetic-injector-bundle

This bundle allow you to define global javascripts and stylesheets

image

troopers/assetic-injector-bundle

This bundle allow you to define global javascripts and stylesheets

  • Tuesday, February 13, 2018
  • by lenybernard
  • Repository
  • 6 Watchers
  • 19 Stars
  • 18,374 Installations
  • PHP
  • 1 Dependents
  • 1 Suggesters
  • 9 Forks
  • 2 Open issues
  • 7 Versions
  • 4 % Grown

The README.md

Troopers, (*1)

License Version Packagist DL SensioLabsInsight Twitter Follow, (*2)

=============, (*3)

AsseticInjectorBundle

Description

The AsseticInjectorBundle allows you to automatically include javascripts and stylesheets anywhere in your project., (*4)

This bundle will scan every registered bundles and search for an assetic_injector.json file. From this file, the injector will collect the resources and inject them into the assetic engine. To include them, you have to define a tag (foot, head, custom, ... actually the one you choose) and add the tag in the wanted assetic block., (*5)

Install

With Composer :, (*6)

Add this line in your composer.json file :, (*7)

"troopers/assetic-injector-bundle": "~1.0"

Declare the bundle in your AppKernel.php:, (*8)

public function registerBundles() {
    $bundles = array(
        [...]
        new Troopers\AsseticInjectorBundle\TroopersAsseticInjectorBundle(),
        [...]

How it works

.. Declare an assetic_injector.json in the Resource/config folder of your application or bundle., (*9)

Within this file, list all the tags and the correspondant resource to inject :, (*10)

{
    "require_all":
    {
        "javascripts":
        {
            "head": "@MyBundle/Resources/public/js/myscript.js"
        },
        "stylesheets":
        {
            "head": "@MyBundle/Resources/public/css/mystyle.css"
        }
    }
}

.. Include the correspondant tag in your assetic's block with the code : injector="tag", (*11)

i.e :, (*12)

    {% javascripts injector="head"
        '@MyAcmeDemoBundle/Resources/public/jsloremipsumdolorsitamet.js'
     %}
    <script type="text/javascript" src="{{ asset_url }}"></script>
    {% endjavascripts %}

.. Results, (*13)

The resource associated to the tag is injected with assetic_injector.json., (*14)

i.e :, (*15)

    {% javascripts injector="head"
        '@MyAcmeDemoBundle/Resources/public/jsloremipsumdolorsitamet.js'
        '@MyBundle/Resources/public/js/myscript.js'
     %}
    <script type="text/javascript" src="{{ asset_url }}"></script>
    {% endjavascripts %}

Enjoy !

No more needs to include javascript or stylesheets from assetic injector's ready bundles ! Just add the tag and here you are !, (*16)

The Versions

13/02 2018

dev-master

9999999-dev http://troopers.agency

This bundle allow you to define global javascripts and stylesheets

  Sources   Download

MIT

The Requires

 

assetic injector

26/05 2017

1.1.3

1.1.3.0 http://troopers.agency

This bundle allow you to define global javascripts and stylesheets

  Sources   Download

MIT

The Requires

 

assetic injector

21/05 2017

1.1.2

1.1.2.0 http://troopers.agency

This bundle allow you to define global javascripts and stylesheets

  Sources   Download

MIT

The Requires

 

assetic injector

06/03 2017

1.1.1

1.1.1.0 http://troopers.agency

This bundle allow you to define global javascripts and stylesheets

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

assetic injector

03/10 2016

1.1.0

1.1.0.0 http://troopers.agency

This bundle allow you to define global javascripts and stylesheets

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

assetic injector

03/10 2016

dev-analysis-zGJG4r

dev-analysis-zGJG4r http://troopers.agency

This bundle allow you to define global javascripts and stylesheets

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

assetic injector

31/01 2016

1.0.0

1.0.0.0 http://appventus.com

This bundle allow you to define global javascripts and stylesheets

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

assetic injector