Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in lastRun() api docs. #2315

Comments

@TheDancingCode
Copy link

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.

@phated phated closed this as completed in ea52a92 Apr 27, 2019
@phated
Copy link
Member

phated commented Apr 27, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment