Skip to content

Instantly share code, notes, and snippets.

@meonkeys
Forked from lavoiesl/assets_version.php
Created November 17, 2012 00:44
Show Gist options
  • Save meonkeys/4092228 to your computer and use it in GitHub Desktop.
Save meonkeys/4092228 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 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment