The lastRun() api docs contain an error. Under usage, it provides the following recipe:
const { src, dest, lastRun, watch } = require('gulp');
const imagemin = require('gulp-imagemin');
function images() {
return src('src/images/**/*.jpg', { since: lastRun(images) })
.pipe(imagemin())
.pipe(dest('build/img/'));
}
function watch() {
watch('src/images/**/*.jpg', images);
}
exports.watch = watch;
However, running this gives a SyntaxError: Identifier 'watch' has already been declared. You can't name the function watch, since watch is already declared as the gulp command in de destructuring assignment.
The
lastRun()api docs contain an error. Under usage, it provides the following recipe:However, running this gives a SyntaxError:
Identifier 'watch' has already been declared. You can't name the functionwatch, sincewatchis already declared as the gulp command in de destructuring assignment.