This bundle helps you using your assets versioned with gulp-rev in a symfony project by
making the twig function asset
return the files mapped in your gulp-rev manifest.
composer require irozgar/gulp-rev-versions-bundle
<?php
// app/AppKernel.php
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new Irozgar\GulpRevVersionsBundle\IrozgarGulpRevVersionsBundle(),
);
}
}
The configuration of the bundle depends on the symfony version
Now you have to make the bundle replace the default version strategy for your assets. To make this add the following to your config.yml file:
# app/config/config.yml
irozgar_gulp_rev_versions:
replace_default_version_strategy: ~
# This section is needed only if you use symfony packages
# packages in this list will use the version strategy
packages:
- one_package
- another_package
This symfony version introduced a new option to configure the version strategy.
Add this to your config.yml to tell symfony what version strategy it should use
# app/config/config.yml
framework:
# ...
assets:
version_strategy: irozgar_gulp_rev_versions.asset.gulp_rev_version_strategy
# ...
# This is only needed if using a custom path for the manifest file
irozgar_gulp_rev_versions:
manifest_path: "your/custom/path/rev-manifest.json"
The default location of the rev-manifest.json file is app/Resources/assets/rev-manifest.json. You can customize it by adding the following lines to your config.yml
# app/config/config.yml
irozgar_gulp_rev_versions:
manifest_path: "your/custom/path/rev-manifest.json"
NOTE All paths will be relative to %kernel.root_dir%