humanmade/hm-base — pull request #11 by mattheu (2013-10-11 13:51:11+00:00)
Title: Cache-busting magic

On WPR, we have some resource cache-busting magic:

```
/** Automatically append mtime to the version for cache-busting action **/
add_action( 'wp_enqueue_scripts', function() {
global $wp_styles, $wp_scripts;

foreach( array( 'wp_styles', 'wp_scripts' ) as $resource ) {

foreach( $$resource->registered as $name => $registered_resource ) {
if ( false === stripos( $name, 'wpr-' ) )
continue;

$file = str_replace( 'wordpress/', '', str_replace( home_url( '/' ), ABSPATH, $registered_resource->src ) );
$mtime = filectime( $file );
$$resource->registered[$name]->ver = $$resource->registered[$name]->ver . '-' . $mtime;
}
}
}, 100 );
```

It would be nice to have this as a part of all our projects by default.