Refreshes client cache for JS and CSS files by appending a custom object or string based on the current date/time
npm install gulp-cache-refreshForked combination of both gulp-cache-bust and cache-bust, removed old dependencies and added some additional functionality.
gulp-cache-refresh as a development dependency:npm install --save gulp-cache-refresh
Then, add it to your gulpfile.js:
var cachebust = require('gulp-cache-refresh');
gulp.src('./dist//.html')
.pipe(cachebust({
type: 'timestamp'
}))
.pipe(gulp.dest('./dist'));
If you want to use a custom value, any value other than 'timestamp' will be appended.
var cachebust = require('gulp-cache-refresh');
var Foo = Environment.BuildNumber;
gulp.src('./dist//.html')
.pipe(cachebust({
type: Foo
}))
.pipe(gulp.dest('./dist'));
cache-bust(options)
####options.type: value
Type: String
Default: 'timestamp'
Most common usage, appends timestamp to path
Type: String
Value: 'timestamp'
Other usages, append any custom variable such as environment build number
Type: String
Value: Custom Variable
Misc: Null or Undefined values will be defaulted to to an appended 'timestamp' it falls differently in code logic to allow for easy customization.