shadesoft / twig-asset-version
Twig extension for versioning assets.
Fund package maintenance!
Ko Fi
www.buymeacoffee.com/ShadeSoft
www.paypal.me/ShadeSoft
Installs: 131
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:package
Requires
- twig/twig: ^2|^3
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 }}