vdaubry
vdaubry

Reputation: 11439

Cache busting Angular views

I want to serve an Angular application through Cloudfront, when i make a modification to an html file, what is the best way to serve the latest version of this file ?

I use grunt-filerev to versions assets but it cannot version html files. Is it possible to do cache busting also on html files ?

I understand that it implies to parse and replace templateUrl for the routeProvider. Is there any way to do this elegantly, or should i just rely on http cache headers ?

Upvotes: 0

Views: 1613

Answers (1)

Ilan Frumer
Ilan Frumer

Reputation: 32377

I use gulp-rev-all.

You need to follow this guideline:

  • Never cache the main index file.
  • Cache forever all other static assets.
  • Do not refer to assets with variables ( FOLDER + '/page.html' ) , always refer to files by full relative path.
  • If you have a build process, stage it first to a temporary folder then create a revisioning of the package.

Upvotes: 1

Related Questions