Skip to content

Instantly share code, notes, and snippets.

@james2doyle
Created May 24, 2017 17:34
Show Gist options
  • Save james2doyle/39b314303a412cd59c1cb8f8bf492a19 to your computer and use it in GitHub Desktop.
Save james2doyle/39b314303a412cd59c1cb8f8bf492a19 to your computer and use it in GitHub Desktop.
Cache bust CSS files on Hubspot
// get all the link files with timestamp caches
Array.from(document.querySelectorAll('link[href*="?t="]')).forEach(el => {
// replace the href with a new one with a refreshed cache stamp
el.href = el.href.replace(/(?:t=)(\d+)/, 't=' + Date.now());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment