Skip to content

Instantly share code, notes, and snippets.

@rickycodes
Last active December 12, 2015 06:49
Show Gist options
  • Save rickycodes/4732521 to your computer and use it in GitHub Desktop.
Save rickycodes/4732521 to your computer and use it in GitHub Desktop.
Cache bust your apps
$(function(){
var bust = Date().now();
var resources = [
{ html : '<script>', attr : 'src', link : 'js/init.js?v=' }
, { html : '<link rel="stylesheet">', attr : 'href', link : 'css/style.css?v=' }
];
$.each(resources, function(i,v) {
$(v.html).attr(v.attr, v.link + bust).appendTo( 'body' );
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment