shadesoft/twig-asset-version

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

Twig extension for versioning assets.

v1.1.1 2020-02-05 13:28 UTC

This package is auto-updated.

Last update: 2023-10-02 20:20:15 UTC


README

Twig extension for versioning assets.

Installation

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require shadesoft/twig-asset-version

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Including into Symfony 3-4 container (if autowire and autoconfigure is set to true)

# app/config/services.yml for Symfony 3 or config/services.yaml for Symfony 4

ShadeSoft\Twig\AssetVersionExtension: ~

Including into Symfony 2 container

# app/config/services.yml

shadesoft.twig.asset_version_extension:
    class: ShadeSoft\Twig\AssetVersionExtension
    tags:
        - { name: twig.extension }

Including into Slim Framework's Twig view renderer

// src/dependencies.php

// ...
$container['view'] = function($c) {
    //...
    $view->addExtension(new ShadeSoft\Twig\AssetVersionExtension);
    //...
}

Usage

Add \ShadeSoft\Twig\AssetVersionExtension to your Twig environment's dependencies (or include into one of the frameworks above), then you can use the filter:

{{ 'asset_path'|versionify }}