A gulp plugin that provides a persisted file cache
yarn add -D gulp-local-cache
# npm works too
npm i -D gulp-local-cache
const cache = require('gulp-local-cache')
const gulp = require('gulp')
gulp.task('lint', () => {
return gulp.src('src/*.js')
.pipe(cache.filter())
// ...
Clear the cache. A key can be provided to specifically clear that cache
// clear entire cache
cache.clear()
// only clear `assets` cache
cache.clear('assets')
Filter out cached files that haven't changed. An optional cache key can be provided if you need to, for example, cache files at multiple stages of the build
gulp.task('assets', () => {
return gulp.src('*.js')
.pipe(cache.filter('assets'))
// ...
Get or set the location of the cache file. Default path is .gulpcache
// get current
cache.path()
// set new
cache.path('.cache/my-cache')