Skip to content

Error in lastRun() api docs. #2315

Closed
@TheDancingCode

Description

@TheDancingCode

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.

Activity

phated

phated commented on Apr 27, 2019

@phated
Member

Thanks @TheDancingCode! I've rewritten it to export a default task.

63 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Error in `lastRun()` api docs. · Issue #2315 · gulpjs/gulp