title: Symfony2 assets versioning by file
body: <h2>Question</h2>
  <p>Is it possible on Symfony2 use <strong>assets_version by file</strong>?</p>
  <h2>Background</h2>
  <p>We are using assets_version and <a href="http://symfony.com/doc/current/reference/configuration/framework.html#assets-version-format" rel="noreferrer">assets_version_format</a> to manage the files version and force the cache update on CDN's and browser cache.</p>
  <p>This is working like charm!, but, we found that there is only one <code>assets_version</code> parameters for all the static resources used.</p>
  <p>That is a problem since our webapp, has a long amount of static resources and we are deploying changes to prod environment daily. This situation kills the cache. :(</p>
  <p>This is our current config:</p>
  <p><em>config.yml</em></p>
  <pre><code>framework:
     
      templating:
          engines: ['twig']
          assets_version: %assets_version%
          assets_version_format:  &quot;stv%%2$s/%%1$s&quot;
  
  # Assetic Configuration
  assetic:
      debug:          %kernel.debug%
      use_controller: false
      # java: /usr/bin/java
      filters:
           cssrewrite: ~
           closure:
               jar: %kernel.root_dir%/java/compiler.jar
           yui_css:
               jar: %kernel.root_dir%/java/yuicompressor-2.4.6.jar
  </code></pre>
  <p><em>sometemplate.html.twig</em></p>
  <pre><code>    {% stylesheets 'bundles/webapp/css/funCommon.css'
                         'bundles/webapp/css/funMobile.css'
                         filter='?yui_css'
          %}
          &lt;link rel=stylesheet href='{{ asset_url }}'&gt;
          {% endstylesheets %}
      
      {% javascripts 'bundles/webapp/js/app.js'
                     'bundles/webapp/js/utils.js'
                      filter='?closure'  %}
          &lt;script src=&quot;{{ asset_url }}&quot;&gt;&lt;/script&gt;
          {% endjavascripts %}
  
  {% javascripts 'bundles/webapp/js/moduleX.js'
                     'bundles/webapp/js/utilsX.js'
                      filter='?closure'  %}
          &lt;script src=&quot;{{ asset_url }}&quot;&gt;&lt;/script&gt;
          {% endjavascripts %}
  </code></pre>
  <p><strong>When I change any</strong> css file or a module JS or any other file, <strong>all paths are changed</strong>.</p>
  <p><strong>I would like to manage the version parameter of assets_version_format by parameter of javascript/stylesheet twig tag.</strong></p>
  <p><em>This is what I'm looking for:</em></p>
  <pre><code>{% javascripts 'bundles/webapp/js/app.js'
                 'bundles/webapp/js/utils.js'
                  filter='?closure' **version='XX'** %}
      &lt;script src=&quot;{{ asset_url }}&quot;&gt;&lt;/script&gt;
      {% endjavascripts %}
    
  </code></pre>