我究竟做错了什么?
gulpfile.js
'use strict';
// Modules & Plugins
var gulp = require('gulp');
const image = require('gulp-image');
var $ = require('gulp-load-plugins')();
let directories = [
'2006/Art1',
'2006/Art2',
'2010/Art1'
];
function gulpTask(directoryName) {
gulp.task('blogmotionAllMedia', function () {
return gulp
.src('src/content/' + directoryName + '/media/*.{jpg,jpeg,png,gif}')
.pipe($.responsive({
'*.jpg': [
{ width: 400, rename: { suffix: '-4' } },
{ rename: { suffix: '-6' } }
],
}))
.pipe(image({
jpegRecompress: true
}))
.pipe(gulp.dest('dist/content/' + directoryName + '/media'))
});
}
var directory;
for (directory in directories) {
gulpTask(directory);
}
运行任务
npx gulp gulpTask
意外
我收到以下错误消息:
Task never defined: gulpTask