2017 © Pedro Peláez
 

library asset-bundle

Include assets at any point, which are cached and injected at the end of head or body.

image

rvanginneken/asset-bundle

Include assets at any point, which are cached and injected at the end of head or body.

  • Wednesday, January 10, 2018
  • by rvanginneken
  • Repository
  • 1 Watchers
  • 4 Stars
  • 152 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 22 Versions
  • 14 % Grown

The README.md

AssetBundle

The AssetBundle makes it easy to include assets at any point in your twig files and render it at the end of the <head> and <body> tags in the page. No blocks needed. Stylesheets are printed inline and all results are cached in production, following Symfony's cache.app settings., (*1)

In debug mode, actual assets are served. In no-debug mode, files are copied to web/asset_cache with unique naming. The directory is automatically cleared with the cache:clear command. Using unique file names guarantees browser cache busting when the application cache is cleared., (*2)

Installation

Require the bundle with composer:, (*3)

    $ composer require rvanginneken/asset-bundle

Enable the bundle in the AppKernel:, (*4)

    public function registerBundles()
    {
        $bundles = [
            // ...
            new RVanGinneken\AssetBundle\RVanGinnekenAssetBundle(),
            // ...
        ];
    }

Ignore the asset cache directory (used to bust browser cache). Put the following in your .gitignore:, (*5)

    # ..
    /web/asset_cache/
    # ..

That's it., (*6)

Usage

Note: priorities are optional and are only added to these examples to show their availability., (*7)

Include a stylesheet:, (*8)

    {% asset 'css_file', 'css/hello_world.css', 0 %}

Include inline style:, (*9)

    {%- set inline_style_hello_world -%}
        <style>
            body {
                background-color: lightblue;
            }
        </style>
    {%- endset -%}

    {% asset 'css', inline_style_hello_world, 0 %}

Include a javascript file:, (*10)

    {% asset 'javascript_file', 'js/hello_world.js', 0 %}

Include inline javascript:, (*11)

    {%- set inline_javascript_hello_world -%}
        <script type="text/javascript">
            console.log('Hello world!');
        </script>
    {%- endset -%}

    {% asset 'javascript', inline_javascript_hello_world, 0 %}

The Versions

10/01 2018

2.x-dev

2.9999999.9999999.9999999-dev

Include assets at any point, which are cached and injected at the end of head or body.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

10/01 2018

2.1.2

2.1.2.0

Include assets at any point, which are cached and injected at the end of head or body.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

10/01 2018

dev-master

9999999-dev

Include assets at any point, which are cached and injected at the end of head or body.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

10/01 2018

2.1.1

2.1.1.0

Include assets at any point, which are cached and injected at the end of head or body.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

10/01 2018

dev-revert-4-2.x

dev-revert-4-2.x

Include assets at any point, which are cached and injected at the end of head or body.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

10/01 2018

dev-revert-2-3.x

dev-revert-2-3.x

Include assets at any point, which are cached and injected at the end of head or body.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

10/01 2018

dev-2.x-bck

dev-2.x-bck

Include assets at any point, which are cached and injected at the end of head or body.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

10/01 2018

2.1.0

2.1.0.0

Include assets at any point, which are cached and injected at the end of head or body.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

10/01 2018

3.x-dev

3.9999999.9999999.9999999-dev

Include assets at any point, which are cached and injected at the end of head or body.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

10/01 2018

dev-3.x-bck

dev-3.x-bck

Include assets at any point, which are cached and injected at the end of head or body.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

10/01 2018

3.0.1

3.0.1.0

Include assets at any point, which are cached and injected at the end of head or body.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

10/01 2018

2.0.3

2.0.3.0

Include assets at any point, which are cached and injected at the end of head or body.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

10/01 2018

3.0.0

3.0.0.0

Include assets at any point, which are cached and injected at the end of head or body.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

10/01 2018

2.0.2

2.0.2.0

Include assets at any point, which are cached and injected at the end of head or body.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

10/01 2018

2.0.1

2.0.1.0

Include assets at any point, which are cached and injected at the end of head or body.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

06/01 2018

2.0.0

2.0.0.0

Include assets at any point, which are cached and injected at the end of head or body.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

20/12 2017

1.5.0

1.5.0.0

Include assets at any point, which are cached and injected at the end of head or body.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

19/12 2017

1.4.0

1.4.0.0

Include assets at any point, which are cached and injected at the end of head or body.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

19/12 2017

1.3.0

1.3.0.0

Include assets at any point, which are cached and injected at the end of head or body.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

17/11 2017

1.2.0

1.2.0.0

Dynamically include assets.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

17/11 2017

1.1.0

1.1.0.0

Dynamically include assets.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

twig cache bundle symfony asset include

14/11 2017

1.0.0

1.0.0.0

Dynamically include assets.

  Sources   Download

MIT

The Requires

 

by Roy Van Ginneken

cache bundle symfony asset