Skip to content

Instantly share code, notes, and snippets.

@lavoiesl
Created October 24, 2012 18:02
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save lavoiesl/3947737 to your computer and use it in GitHub Desktop.
Save lavoiesl/3947737 to your computer and use it in GitHub Desktop.
Automatic cache busting using Git commit in Symfony2
<?php
// app/config/assets_version.php
$container->loadFromExtension('framework', array(
'templating' => array(
'engines' => array('twig'),
'assets_version' => exec('git rev-parse --short HEAD'),
),
));
# app/config/config.yml
imports:
- { resource: parameters.yml }
#...
- { resource: assets_version.php }
@s7anley
Copy link

s7anley commented Sep 4, 2014

Why don't just set parameter and use it later in config file? It's much simpler and transparent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment