i use angular-template-cache. follow code exist for remove template cache in app module but i need to remove all templateCache with gulp on dev machine.
myApp.run(function($rootScope, $templateCache) {
$rootScope.$on('$viewContentLoaded', function() {
$templateCache.removeAll();
});
});
The best way to avoid template caching is revisioning your files.
Since you are using
gulp, you can revision your files usinggulp-revorgulp-rev-all.What is revisioning?
Static asset revisioning by appending content hash to filenames
unicorn.css→unicorn-d41d8cd98f.css.i.e., On every builds the filename changes and that way avoiding template caching. You can revision every file including
.html,.css,.js,images,videosetc.Since
gulp-rev-allis the latest and forked fromgulp-rev, let's talk aboutgulp-rev-allonly.Revisioning using
gulp-rev-all:if you want to neglect some files from revisioning, you can do that like this.
Consider all your files are in the folder
distand save the new revisioned files in the folderwww.(You can save them indistalso. Consideringwwwis your build directory.)Next, create a
manifestfile to map your files with the revisioned one. for that use.manifestFile()function. which returns a transform function that will filter out any existing files going through the pipe and will emit a new manifest file. Must be called after .revision().An asset manifest, mapping the original paths to the revisioned paths, will be written to
www/manifest/rev-manifest.json:Complete code:
Read more about
gulp-rev-allhere