Download the PHP package kachkaev-fork/assets-version-bundle without Composer
On this page you can find all versions of the php package kachkaev-fork/assets-version-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kachkaev-fork/assets-version-bundle
More information about kachkaev-fork/assets-version-bundle
Files in kachkaev-fork/assets-version-bundle
Package assets-version-bundle
Short Description Automates the process of updating assets version in Symfony2 projects
License MIT
Homepage http://github.com/kachkaev/KachkaevAssetsVersionBundle
Informations about the package assets-version-bundle
KachkaevAssetsVersionBundle
The purpose of this Symfony2 bundle is to automate the process of updating assets version each time it needs to be changed − doing this manually is a real pain.
The bundle can read and write assets_version
parameter in app/config/parameters.yml
from Symfony console. One of the advantages of the bundle is that it does not break existing formatting in the yaml file, all user comments are also kept.
So, if you configuration looks the following way:
then you can simply call php app/console assets_version:increment
to change version from v42
to v43
. It is important to clear prod
cache afterwards as this is not done automatically. More features are described below.
Detailed information on using assets versioning can be found in Symfony2 documentation: http://symfony.com/doc/current/reference/configuration/framework.html#ref-framework-assets-version
Installation
Composer
Add the following dependency to your project’s composer.json file:
Now tell composer to download the bundle by running the command:
Composer will install the bundle to vendor/kachkaev
directory.
Adding bundle to your application kernel
Configuration
Here is the default configuration for the bundle:
In most cases custom configuration is not needed, so simply add the following line to your app/config/config.yml
:
Note: It is not recommended to store real value of assets version in config.yml
because its incrementing will cause git conflicts. It is better to keep it in parameters.yml
added to .gitignore
and also have parameters.yml.dist
with blank or initial value for assets version.
Usage
The bundle adds two commands to symfony console: assets_version:increment
and assets_version:set
that are incrementing and setting assets version, respectively. Usage examples:
Value for assets version must consist only of letters, numbers and the following characters: .-_
. Incrementing only works when existing value is integer or has integer ending.
Please don’t forget to clear cache by calling php app/console cache:clear --env=prod
for changes to take effect in the production environment.
If you are using assetic bundle on your production server and want to change asset version at each dump automatically, you may find useful the following shell script:
At the moment the bundle only works with yaml files, but more file types can be added if there is a demand.