Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

ShadeSoft/TwigAssetVersion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TwigAssetVersion

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 }}