我第一次使用 gulp。在我的 gulpfile.js 中包含
var gulp = require('gulp');
var imagemin = require('gulp-imagemin');
gulp.task('default', function () { console.log('Hello Gulp!') });
gulp.task('imagemin', function() {
var img_src = 'src/images/**/*', img_dest = 'build/images';
gulp.src(img_src)
.pipe(changed(img_dest))
.pipe(imagemin())
.pipe(gulp.dest(img_dest));
});
从我的 woking 文件夹中以 $ gulp imagemin 运行 Git bash 时
但它显示以下错误
[11:35:12] Using gulpfile C:\xampp\htdocs\work\gulpfile.js
[11:35:12] Starting 'imagemin'...
[11:35:12] 'imagemin' errored after 10 ms
[11:35:12] ReferenceError: changed is not defined
at Gulp.<anonymous> (C:\xampp\htdocs\work\gulpfile.js:8:10)
at module.exports (C:\xampp\htdocs\work\node_modules\orchestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask (C:\xampp\htdocs\work\node_modules\orchestrator\index.js:273:3)
at Gulp.Orchestrator._runStep (C:\xampp\htdocs\work\node_modules\orchestrator\index.js:214:10)
at Gulp.Orchestrator.start (C:\xampp\htdocs\work\node_modules\orchestrator\index.js:134:8)
at C:\Users\58_user\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:129:20
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:607:11)
at run (bootstrap_node.js:418:7)
我该如何纠正这个问题?请帮我。任何人都可以为 angularjs 提供 gulp 安装指南。提前致谢