Skip to content

Instantly share code, notes, and snippets.

@kyleguate
kyleguate / AngularCacheBusting.js
Last active May 28, 2016 15:00
Gulp task for cache busting angular template files
/*
PURPOSE
The purpose of this gist is to show how you can dynamically bust the cache of your angular template files only when the files have been changed.
PREREQUISITES:
1) You use Gulp to build/organize your front end application
2) In your front end build process you have already run the 'app:scripts' and 'app:templates' tasks:
'app:scripts' - This takes all of your separate app js files and combines them into one file to deliver to the browser.
'app:templates' - If you are using Jade or another html templating library/framework then this task would convert those files into browser-readable html files
I specify these two tasks as dependencies to the cache busting task defined below. They can easily be modified or omitted to match your specific build process